Struct prepona::algo::Bfs [−][src]
pub struct Bfs<'a, L: BfsListener> { /* fields omitted */ }
Visits graph vertices in a breath-first manner.
Implementations
impl<'a, L: BfsListener> Bfs<'a, L>
[src]
impl<'a, L: BfsListener> Bfs<'a, L>
[src]pub fn init<G>(graph: &G, listener: &'a mut L) -> Self where
G: Vertices + Neighbors,
[src]
G: Vertices + Neighbors,
Initializes the structure.
Arguments
graph
: Graph to perform the Bfs on.listener
: To listen to bfs events.
pub fn init_with_starts<G>(
graph: &G,
listener: &'a mut L,
start_ids: Vec<usize>
) -> Self where
G: Vertices + Neighbors,
[src]
graph: &G,
listener: &'a mut L,
start_ids: Vec<usize>
) -> Self where
G: Vertices + Neighbors,
Initializes the structure.
Arguments
graph
: Graph to perform the BFS on.listener
: To listen to bfs events.start_ids
: List of ids to start the bfs from.
pub fn execute<G>(&mut self, graph: &G) where
G: Vertices + Neighbors,
[src]
G: Vertices + Neighbors,
Performs Bfs visit and calls the listener on every event.
pub fn get_queue(&self) -> &VecDeque<usize>
[src]
Returns
Queue of the bfs structure.
pub fn get_colors(&self) -> &Vec<Color>
[src]
Returns
Color of each vertex. Note that color of vertex with virtual id of i
is in get_colors()[i]
.
pub fn get_discovered(&self) -> &Vec<Magnitude<usize>>
[src]
Returns
discovered time of each vertex. Note that discovered time of vertex with virtual id of i
is in get_colors()[i]
.
pub fn get_finished(&self) -> &Vec<Magnitude<usize>>
[src]
Returns
finished time of each vertex. Note that finished time of vertex with virtual id of i
is in get_colors()[i]
.
pub fn get_id_map(&self) -> &IdMap
[src]
Returns
IdMap
used by Bfs
to map real ids to virtual ids(and vice versa).
pub fn dissolve(self) -> (Vec<Magnitude<usize>>, Vec<Magnitude<usize>>, IdMap)
[src]
Returns
(Discovered time, Finished time, IdMap
)
Auto Trait Implementations
impl<'a, L> !RefUnwindSafe for Bfs<'a, L>
impl<'a, L> !RefUnwindSafe for Bfs<'a, L>
impl<'a, L> !UnwindSafe for Bfs<'a, L>
impl<'a, L> !UnwindSafe for Bfs<'a, L>