Trait petgraph::data::ElementIterator

source ·
pub trait ElementIterator<N, E>: Iterator<Item = Element<N, E>> {
    // Provided method
    fn filter_elements<F>(self, f: F) -> FilterElements<Self, F> 
       where Self: Sized,
             F: FnMut(Element<&mut N, &mut E>) -> bool { ... }
}
Expand description

Iterator adaptors for iterators of Element.

Provided Methods§

source

fn filter_elements<F>(self, f: F) -> FilterElements<Self, F>
where Self: Sized, F: FnMut(Element<&mut N, &mut E>) -> bool,

Create an iterator adaptor that filters graph elements.

The function f is called with each element and if its return value is true the element is accepted and if false it is removed. f is called with mutable references to the node and edge weights, so that they can be mutated (but the edge endpoints can not).

This filter adapts the edge source and target indices in the stream so that they are correct after the removals.

Implementors§

source§

impl<N, E, I> ElementIterator<N, E> for I
where I: Iterator<Item = Element<N, E>> + ?Sized,