All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Pages
k_center_euclidean_metric_example.cpp
Go to the documentation of this file.
1 //=======================================================================
2 // Copyright (c) 2014 Piotr Smulewicz
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //=======================================================================
19 #include "paal/utils/irange.hpp"
20 
21 #include <iostream>
22 #include <vector>
23 
24 int main() {
25  // sample data
26  const int PARTS = 2;
27  std::vector<std::pair<int, int>> centers,
28  vertices = { { 0, 0 }, { 1, 1 }, { 0, 5 }, { 2, 6 } };
30  // solution
31  std::cout << paal::greedy::kCenter(m, PARTS, vertices.begin(),
32  vertices.end(), back_inserter(centers))
33  << std::endl;
34 }
metric with euclidean distance
int main()
[K Center Example]
data_structures::metric_traits< Metric >::DistanceType 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:
Definition: k_center.hpp:43