Trait GraphIterator

Source
pub trait GraphIterator<G: ?Sized>: Clone {
    type Item;

    // Required method
    fn next(&mut self, g: &G) -> Option<Self::Item>;

    // Provided methods
    fn size_hint(&self, _g: &G) -> (usize, Option<usize>) { ... }
    fn count(self, g: &G) -> usize { ... }
    fn iter(self, g: &G) -> GraphIter<'_, G, Self> 
       where G: Sized { ... }
}
Expand description

A graph iterator.

This is roughly the same interface as a standard iterator. However, all its method take additionally the graph itself as parameter. This allows the iterator to not contain a reference to internal graph data.

This might be useful for algorithms that need to store several iterators because they require less memory (they do not need to store a reference to the same graph, each!).

Required Associated Types§

Required Methods§

Source

fn next(&mut self, g: &G) -> Option<Self::Item>

Provided Methods§

Source

fn size_hint(&self, _g: &G) -> (usize, Option<usize>)

Source

fn count(self, g: &G) -> usize

Source

fn iter(self, g: &G) -> GraphIter<'_, G, Self>
where G: Sized,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a, A, I> GraphIterator<&'a A> for AdjacenciesWrapIt<I>
where I: GraphIterator<A>,

Source§

type Item = <I as GraphIterator<A>>::Item

Source§

impl<'a, G, I> GraphIterator<&'a G> for WrapIt<I>
where I: GraphIterator<G>,

Source§

type Item = <I as GraphIterator<G>>::Item

Source§

impl<'a, G, I> GraphIterator<Network<'a, G>> for NetworkEdgeIt<G, I>
where I: GraphIterator<G>, I::Item: Clone,

Source§

impl<'a, G, I> GraphIterator<Network<'a, G>> for NetworkNodeIt<I>
where I: GraphIterator<G>,

Source§

type Item = <I as GraphIterator<G>>::Item

Source§

impl<'a, G, I, N, D> GraphIterator<Network<'a, G>> for NetworkInIt<I>
where I: GraphIterator<G, Item = (D, N)>, D: DirectedEdge,

Source§

impl<'a, G, I, N, D> GraphIterator<Network<'a, G>> for NetworkIncidentIt<I, I::Item>
where I: GraphIterator<G, Item = (D, N)>, N: Clone, D: DirectedEdge + Clone,

Source§

impl<'a, G, I, N, D> GraphIterator<Network<'a, G>> for NetworkOutIt<I>
where I: GraphIterator<G, Item = (D, N)>, D: DirectedEdge,

Source§

impl<'a, G, I, N, E> GraphIterator<Network<'a, G>> for NetworkNeighIt<G, I>
where N: Clone, E: Clone, I: GraphIterator<G, Item = (E, N)>,

Source§

type Item = (NetworkEdge<E>, N)

Source§

impl<'a, ID> GraphIterator<VecGraph<ID>> for rs_graph::vecgraph::EdgeIt<ID>
where ID: 'a + PrimInt + Unsigned,

Source§

type Item = Edge<ID>

Source§

impl<'a, ID> GraphIterator<VecGraph<ID>> for rs_graph::vecgraph::NeighIt<'a, ID>
where ID: PrimInt + Unsigned,

Source§

type Item = (Edge<ID>, Node<ID>)

Source§

impl<'a, ID> GraphIterator<VecGraph<ID>> for rs_graph::vecgraph::NodeIt<ID>
where ID: 'a + PrimInt + Unsigned,

Source§

type Item = Node<ID>

Source§

impl<'g, G, I> GraphIterator<InEdges<'g, G>> for AdjacenciesWrapIt<I>
where I: GraphIterator<G>,

Source§

type Item = <I as GraphIterator<G>>::Item

Source§

impl<'g, G, I> GraphIterator<Neighbors<'g, G>> for AdjacenciesWrapIt<I>
where I: GraphIterator<G>,

Source§

type Item = <I as GraphIterator<G>>::Item

Source§

impl<'g, G, I> GraphIterator<OutEdges<'g, G>> for AdjacenciesWrapIt<I>
where I: GraphIterator<G>,

Source§

type Item = <I as GraphIterator<G>>::Item

Source§

impl<A, P, I> GraphIterator<FilterAdjacencies<A, P>> for Filtered<I>
where I: GraphIterator<A>, P: for<'r> Fn(&'r I::Item) -> bool,

Source§

type Item = <I as GraphIterator<A>>::Item

Source§

impl<G, I> GraphIterator<Rc<G>> for WrapIt<I>
where I: GraphIterator<G>,

Source§

type Item = <I as GraphIterator<G>>::Item

Source§

impl<G, I> GraphIterator<NonNull<G>> for WrapIt<I>
where I: GraphIterator<G>,

Source§

type Item = <I as GraphIterator<G>>::Item

Source§

impl<ID, N, E> GraphIterator<LinkedListGraph<ID, N, E>> for rs_graph::linkedlistgraph::EdgeIt<ID>
where ID: PrimInt + Unsigned,

Source§

type Item = Edge<ID>

Source§

impl<ID, N, E> GraphIterator<LinkedListGraph<ID, N, E>> for rs_graph::linkedlistgraph::NeighIt<ID>
where ID: PrimInt + Unsigned,

Source§

type Item = (Edge<ID>, Node<ID>)

Source§

impl<ID, N, E> GraphIterator<LinkedListGraph<ID, N, E>> for rs_graph::linkedlistgraph::NodeIt<ID>
where ID: PrimInt + Unsigned,

Source§

type Item = Node<ID>

Source§

impl<ID, N, E> GraphIterator<LinkedListGraph<ID, N, E>> for OutIt<ID>
where ID: PrimInt + Unsigned,

Source§

type Item = (Edge<ID>, Node<ID>)

Source§

impl<N, E, Ne, NeIt> GraphIterator<FnAdj<N, E, Ne, NeIt>> for FnNeighIt<NeIt>
where NeIt: Iterator<Item = (E, N)> + Clone,