Function cnetworks::clusters [−][src]
pub fn clusters(net: &Network) -> Vec<HashSet<usize>>
Expand description
Obtain vector of clusters present in the network, ordered largest to smallest.
A random element of net
is chosen as the root and the initial cluster is the first (explored)
set returned by explore(net, root)
. From the second (unexplored) set a new node is chosen as
the new root, and the process is repeated until there are no more unexplored nodes.
Examples
let net = Network::new(100, Model::ER { p: 0.05, whole: false }, Weight::None );
let clusters = clusters(&net);
println!("Largest cluster: {:?}", clusters.first().expect("No clusters"));
println!("Smallest cluster: {:?}", clusters.last().expect("No clusters"));