#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 "paal/greedy/k_center/k_center.hpp"
#include "paal/utils/irange.hpp"
#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;
}
| |