Trait petgraph::data::ElementIterator
source · [−]pub trait ElementIterator<N, E>: Iterator<Item = Element<N, E>> {
fn filter_elements<F>(self, f: F) -> FilterElements<Self, F>ⓘNotable traits for FilterElements<I, F>impl<I, F, N, E> Iterator for FilterElements<I, F>where
I: Iterator<Item = Element<N, E>>,
F: FnMut(Element<&mut N, &mut E>) -> bool, type Item = Element<N, E>;
where
Self: Sized,
F: FnMut(Element<&mut N, &mut E>) -> bool,
{ ... }
}
Expand description
Iterator adaptors for iterators of Element
.
Provided Methods
sourcefn filter_elements<F>(self, f: F) -> FilterElements<Self, F>ⓘNotable traits for FilterElements<I, F>impl<I, F, N, E> Iterator for FilterElements<I, F>where
I: Iterator<Item = Element<N, E>>,
F: FnMut(Element<&mut N, &mut E>) -> bool, type Item = Element<N, E>;
where
Self: Sized,
F: FnMut(Element<&mut N, &mut E>) -> bool,
fn filter_elements<F>(self, f: F) -> FilterElements<Self, F>ⓘNotable traits for FilterElements<I, F>impl<I, F, N, E> Iterator for FilterElements<I, F>where
I: Iterator<Item = Element<N, E>>,
F: FnMut(Element<&mut N, &mut E>) -> bool, type Item = Element<N, E>;
where
Self: Sized,
F: FnMut(Element<&mut N, &mut E>) -> bool,
I: Iterator<Item = Element<N, E>>,
F: FnMut(Element<&mut N, &mut E>) -> bool, type Item = Element<N, E>;
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.