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]

pub fn init<G>(graph: &G, listener: &'a mut L) -> Self where
    G: Vertices + Neighbors
[src]

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]

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]

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> Send for Bfs<'a, L> where
    L: Send

impl<'a, L> !Sync for Bfs<'a, L>

impl<'a, L> Unpin for Bfs<'a, L>

impl<'a, L> !UnwindSafe for Bfs<'a, L>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.