pub fn reachable_vertices(&self, index: usize) -> Result<FxHashSet<usize>> {
        if !self.has_vertex(index) {
            bail!("vertex does not exist");
        }

        let mut reachable_vertices: FxHashSet<usize> = FxHashSet::default();
        let mut queue: Vec<usize> = vec![index];

        reachable_vertices.insert(index);

        while let Some(vertex) = queue.pop() {
            self.successors
                .get(&vertex)
                .unwrap()
                .iter()
                .for_each(|&succ| {
                    if reachable_vertices.insert(succ) {
                        queue.push(succ)
                    }
                });
        }

        Ok(reachable_vertices)
    }
/// Computes the set of vertices reachable from the given index.
Computes the set of vertices reachable from the given index.
Computes the set of vertices reachable from the given index .
pub fn reachable_vertices(&self, index: usize) -> Result<FxHashSet<usize>> {
        if !self.has_vertex(index) {
            bail!("vertex does not exist");
        }
        let mut reachable_vertices: FxHashSet<usize> = FxHashSet::default();
        let mut queue: Vec<usize> = vec![index];
        reachable_vertices.insert(index);
        while let Some(vertex) = queue.pop() {
            self.successors
                .get(&vertex)
                .unwrap()
                .iter()
                .for_each(|&succ| {
                    if reachable_vertices.insert(succ) {
                        queue.push(succ)
                    }
                });
        }
        Ok(reachable_vertices)
    }
pub fn reachable_vertices ( & self , index : usize ) -> Result < FxHashSet < usize > > { if ! self . has_vertex ( index ) { bail ! ( " " ) ; } let mut reachable_vertices : FxHashSet < usize > = FxHashSet :: default ( ) ; let mut queue : Vec < usize > = vec ! [ index ] ; reachable_vertices . insert ( index ) ; while let Some ( vertex ) = queue . pop ( ) { self . successors . get ( & vertex ) . unwrap ( ) . iter ( ) . for_each ( | & succ | { if reachable_vertices . insert ( succ ) { queue . push ( succ ) } } ) ; } Ok ( reachable_vertices ) }
Computes the set of vertices reachable from the given index.
Computes the set of vertices reachable from the given index .
&self
index
usize
&self
index
usize