23 return a.centroid().E() > b.centroid().E();
26 void cluster(
double seed_threshold,
double cutoff,
double deltaTime) {
27 int ncluster = clusters_.size();
28 double minwgt = cutoff;
29 std::sort(clusters_.begin(), clusters_.end(), compClusters);
32 unsigned int mi(0), mj(0);
36 for (
unsigned int i = 0; i < clusters_.size(); i++) {
38 if (clusters_[i].empty())
continue;
40 bool iseed = (clusters_[i].centroid().E() >= seed_threshold);
50 for (
unsigned int j = i + 1; j < clusters_.size(); j++) {
51 if (clusters_[j].empty() or
52 (!iseed and clusters_[j].centroid().E() < seed_threshold))
55 double wgt = wgt_(clusters_[i], clusters_[j]);
72 transitionWeights_.insert(std::pair<int, double>(ncluster, minwgt));
73 if (any and minwgt < cutoff) {
75 if (clusters_[mi].centroid().E() < clusters_[mj].centroid().E()) {
79 clusters_[mi].add(clusters_[mj]);
80 clusters_[mj].clear();
85 }
while (minwgt < cutoff and ncluster > 1);
89 double getYMax()
const {
return finalwgt_; }
91 int getNSeeds()
const {
return nseeds_; }
93 std::map<int, double> getWeights()
const {
return transitionWeights_; }
95 std::vector<WorkingCluster> getClusters()
const {
return clusters_; }
101 std::map<int, double> transitionWeights_;
102 std::vector<WorkingCluster> clusters_;