Skip to content

num::connected_components

Defined in header <spatial/connected_components.hpp>

template <typename InCluster, typename Neighbors>
cluster_result connected_components(int n_sites, InCluster &&in_cluster,
                                    Neighbors &&neighbors);

Label the connected clusters of sites where in_cluster(i) holds, by breadth-first search; other sites get -2. neighbors(i, visit) calls visit(j) for each neighbour of i.