src/clustering/ClusterEstimator.cpp
/**
 * The output of the greedy algorithm is an estimate with random cluster labels
 * This function aims to reordonning and renaming these labels to have a
 * more readable result.
 *
 * @param cluster
 *
 * Example : cluster = [5, 5, 5, 17, 23, 5, 17]
 * should be modified to give : cluster = [1, 1, 1, 2, 3, 1, 2]
 */
The output of the greedy algorithm is an estimate with random cluster labels
This function aims to reordonning and renaming these labels to have a
more readable result.

@param cluster


The output of the greedy algorithm is an estimate with random cluster labels This function aims to reordonning and renaming these labels to have a more readable result . @param cluster
void rename_labels(Eigen::VectorXi &cluster) {
  map<int, int> m;
  int current_index(1);
  for (int i = 0; i < cluster.size(); i ++) {
    if (m[cluster(i)] == 0) {
      m[cluster(i)] = current_index;
      cluster(i) = current_index;
      current_index++;
    } else {
      cluster(i) = m[cluster(i)];
    }
  }
}
void rename_labels ( Eigen :: VectorXi & cluster ) { map < int , int > m ; int current_index ( 1 ) ; for ( int i = 0 ; i < cluster . size ( ) ; i ++ ) { if ( m [ cluster ( i ) ] == 0 ) { m [ cluster ( i ) ] = current_index ; cluster ( i ) = current_index ; current_index ++ ; } else { cluster ( i ) = m [ cluster ( i ) ] ; } } }
The output of the greedy algorithm is an estimate with random cluster labels
 This function aims to reordonning and renaming these labels to have a
 more readable result.
The output of the greedy algorithm is an estimate with random cluster labels This function aims to reordonning and renaming these labels to have a more readable result .