Function cnetworks::explore[][src]

pub fn explore(
    net: &Network,
    root: usize
) -> Result<(HashSet<usize>, HashSet<usize>), CNErr>
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

This function pancis when the queue operations fail.

Examples

use cnetworks::*;
let net = Network::new(100, Model::ER { p: 0.05, whole: false }, Weight::None);
let (exp, unexp) = explore(&net, 1).unwrap();
println!("Available from 1: {:?}", exp);
println!("Unavailable from 1: {:?}", unexp);