All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Pages
Namespaces | Functions
k_center.hpp File Reference
#include "paal/data_structures/metric/metric_traits.hpp"
#include "paal/utils/assign_updates.hpp"
#include <vector>

Go to the source code of this file.

Namespaces

 paal
 global namespace of project.
 
 paal::greedy
 Greedy namespace.
 

Functions

template<typename Metric , class OutputIterator , typename ItemIterator >
data_structures::metric_traits
< Metric >::DistanceType 
paal::greedy::kCenter (const Metric &metric, unsigned int numberOfClusters, const ItemIterator iBegin, const ItemIterator iEnd, OutputIterator result)
 this is solve K Center problem and return radius example:

#include <iostream>
#include <vector>
int main() {
// sample data
const int parts = 2;
m(0, 1) = 3;
m(0, 2) = 4;
m(1, 2) = 5;
m(1, 0) = 3;
m(2, 0) = 4;
m(2, 1) = 5;
auto vertices = paal::irange(3);
std::vector<int> centers;
// solution
std::cout << paal::greedy::kCenter(m, parts, vertices.begin(),
vertices.end(), back_inserter(centers))
<< std::endl;
}
More...
 

Detailed Description

Author
Piotr Smulewicz
Version
1.0
Date
2014-01-23

Definition in file k_center.hpp.