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

Like distance, but with multiple targets. Returns a cn::VecMap of (target, distance) pairs. If some target is not in the map it cannot be reached from root.

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, distance) in bfs::distance_many(&net, 1, &[2, 3])?.iter() {
    println!("Distance from 1 to {} is {}", target, distance);
}