Function cnetworks::explore[][src]

pub fn explore(
    net: &Network,
    root: usize
) -> Result<(HashSet<usize>, HashSet<usize>), Error>
Expand description

Explore the network with BFS starting with root. Return a tuple of two HashSets: one with the explored nodes (including the root) and another with the unexplored. Returns Err if the root does not exist. Panics when the network is corrupted or if the queue operations fail.

Examples

use cnetworks::*;
let net = Network::new(100, Model::ER { p: 0.05, whole: false }, Weight::Constant { c: 1.0});
let (exp, unexp) = explore(&net, 1).expect("Node 1 does not exist");
println!("Available from 1: {:?}", exp);
println!("Unavailable from 1: {:?}", unexp);