numerics
Loading...
Searching...
No Matches
connected_components.hpp File Reference

Iterative BFS connected-component labelling. More...

#include <vector>

Go to the source code of this file.

Classes

struct  num::ClusterResult
 

Namespaces

namespace  num
 

Functions

template<typename InCluster , typename Neighbors >
ClusterResult num::connected_components (int n_sites, InCluster &&in_cluster, Neighbors &&neighbors)
 

Detailed Description

Iterative BFS connected-component labelling.

connected_components(n_sites, in_cluster, neighbors)

Template parameters: InCluster callable: bool(int i) – true if site i is in the cluster Neighbors callable: void(int i, F&& f) – calls f(nb) for each neighbor nb of i

Returns ClusterResult where id[i] is: -2 = excluded (in_cluster returned false) >=0 = cluster index

ClusterResult::largest_id and largest_size track the biggest connected component.

Definition in file connected_components.hpp.