[][src]Trait net_ensembles::traits::GraphIterators

pub trait GraphIterators<T, G, A> where
    T: Node,
    A: AdjContainer<T>, 
{ fn contained_iter(&self) -> ContainedIter<T, A>;
fn contained_iter_neighbors(&self, index: usize) -> NContainedIter<T, A>;
fn contained_iter_neighbors_with_index(
        &self,
        index: usize
    ) -> NIContainedIter<T, A>;
fn container_iter(&self) -> Iter<A>;
fn container_iter_neighbors(&self, index: usize) -> NContainerIter<T, A>;
fn dfs(&self, index: usize) -> Dfs<T, A>;
fn dfs_with_index(&self, index: usize) -> DfsWithIndex<T, A>;
fn bfs_index_depth(&self, index: usize) -> Bfs<T, A>; }

Collection of Graph iterators

Required methods

fn contained_iter(&self) -> ContainedIter<T, A>

  • get iterator over additional information stored at each vertex in order of the indices
  • iterator returns a Node (for example EmptyNode or whatever you used)
  • similar to self.container_iter().map(|container| container.contained())

fn contained_iter_neighbors(&self, index: usize) -> NContainedIter<T, A>

  • iterate over additional information of neighbors of vertex index
  • iterator returns &T
  • sort_adj will affect the order
  • panics if index out of bounds

fn contained_iter_neighbors_with_index(
    &self,
    index: usize
) -> NIContainedIter<T, A>

  • iterate over additional information of neighbors of vertex index
  • iterator returns (index_neighbor,&T)
  • sort_adj will affect the order
  • panics if index out of bounds

fn container_iter(&self) -> Iter<A>

  • get iterator over AdjContainer in order of the indices
  • iterator returns AdjContainer<Node>, i.e., A

fn container_iter_neighbors(&self, index: usize) -> NContainerIter<T, A>

  • iterate over additional information of neighbors of vertex index
  • iterator returns &T
  • sort_adj will affect the order
  • panics if index out of bounds

fn dfs(&self, index: usize) -> Dfs<T, A>

returns Iterator

  • the iterator will iterate over the vertices in depth first search order, beginning with vertex index.
  • iterator returns node

Order

Order is guaranteed to be in DFS order, however if this order is not unambigouse adding edges and especially removing edges will shuffle the order.

Note:

Will only iterate over vertices within the connected component that contains vertex index

fn dfs_with_index(&self, index: usize) -> DfsWithIndex<T, A>

returns Iterator

  • the iterator will iterate over the vertices in depth first search order, beginning with vertex index.
  • Iterator returns tuple (index, node)

Order

Order is guaranteed to be in DFS order, however if this order is not unambigouse adding edges and especially removing edges will shuffle the order.

Note:

Will only iterate over vertices within the connected component that contains vertex index

fn bfs_index_depth(&self, index: usize) -> Bfs<T, A>

returns Iterator

  • the iterator will iterate over the vertices in breadth first search order, beginning with vertex index.
  • Iterator returns tuple (index, node, depth)

depth

  • starts at 0 (i.e. the first element in the iterator will have depth = 0)
  • depth equals number of edges in the shortest path from the current vertex to the first vertex (i.e. to the vertex with index index)

Order

Order is guaranteed to be in BFS order, however if this order is not unambigouse adding edges and especially removing edges will shuffle the order.

Note:

Will only iterate over vertices within the connected component that contains vertex index

Loading content...

Implementors

impl<T, E> GraphIterators<T, GenericGraph<T, NodeContainer<T>>, NodeContainer<T>> for E where
    T: Node,
    E: WithGraph<T, GenericGraph<T, NodeContainer<T>>>, 
[src]

impl<T, E> GraphIterators<T, GenericGraph<T, SwContainer<T>>, SwContainer<T>> for E where
    T: Node,
    E: WithGraph<T, GenericGraph<T, SwContainer<T>>>, 
[src]

Loading content...