pub fn path_many(
    net: &Network,
    root: usize,
    targets: &[usize]
) -> Result<VecMap<Path>>
Expand description

Like path, but with multiple targets. Returns a cn::VecMap of (target, Path) pairs.

Returns cn::Err::NoSuchNode if the root or any of the target nodes do not exist and cn::Err::NoTarget if the targets slice is empty.

Examples

let net = Network::new(100, Model::ER { p: 0.05, whole: false }, Weight::default());
for (target, path) in bfs::path_many(&net, 1, &[2, 3])?.iter() {
    match path.as_vec() {
        Some(p) => {
            println!("Path from {} to 1:", target);
            println!("{:?}", p);
        },
        None => println!("Cannot reach {} from 1", target),
    }
}