pub trait VertexWalker<'graph>: Walker<'graph> {
// Required method
fn next(
&mut self,
graph: &'graph Self::Graph,
) -> Option<<Self::Graph as Graph>::VertexId>;
// Provided methods
fn vertices_by_id<Iter>(
self,
vertex_ids: Iter,
) -> VertexIter<'graph, Self, Iter::IntoIter>
where Iter: IntoIterator<Item = <Self::Graph as Graph>::VertexId> { ... }
fn vertices<'search>(
self,
vertex_search: VertexSearch<'search, Self::Graph>,
) -> Vertices<'search, 'graph, Self> { ... }
fn filter<Predicate>(
self,
predicate: Predicate,
) -> VertexFilter<'graph, Self, Predicate>
where Predicate: Fn(&<Self::Graph as Graph>::VertexReference<'_>, &Self::Context) -> bool { ... }
fn control_flow<Predicate>(
self,
predicate: Predicate,
) -> VertexControlFlow<'graph, Self, Predicate>
where Self: 'graph,
for<'a> Predicate: Fn(&'a <Self::Graph as Graph>::VertexReference<'graph>, &mut Self::Context) -> ControlFlow<Option<&'a <Self::Graph as Graph>::VertexReference<'graph>>, Option<&'a <Self::Graph as Graph>::VertexReference<'graph>>> { ... }
fn take(self, n: usize) -> VertexTake<'graph, Self> { ... }
fn detour<Path, Terminal, WalkerBuilder>(
self,
path: Path,
) -> Detour<'graph, Self, Path, Terminal>
where Path: Fn(VertexWalkerBuilder<'graph, ImmutableMarker, Self::Graph, Waypoint<'graph, Self::Graph, Self::Context>>) -> WalkerBuilder,
WalkerBuilder: Into<WalkerBuilder<'graph, ImmutableMarker, Self::Graph, Terminal>>,
Terminal: Walker<'graph, Graph = Self::Graph>,
<Self as Walker<'graph>>::Graph: 'graph { ... }
fn context<Callback, Context>(
self,
predicate: Callback,
) -> VertexContext<'graph, Self, Callback, Context>
where Callback: Fn(&<Self::Graph as Graph>::VertexReference<'_>, &Self::Context) -> Context { ... }
fn edges(
self,
search: EdgeSearch<'_, Self::Graph>,
) -> Edges<'_, 'graph, Self> { ... }
fn reduce<Reducer>(
self,
reducer: Reducer,
) -> VertexReduce<'graph, Self, Reducer>
where Reducer: for<'a> Fn(&'a <Self::Graph as Graph>::VertexReference<'graph>, &'a <Self::Graph as Graph>::VertexReference<'graph>, &Self::Context) -> &'a <Self::Graph as Graph>::VertexReference<'graph>,
<Self as Walker<'graph>>::Graph: 'graph { ... }
}
Expand description
A trait that defines the basic behavior of a vertex walker, which is a specialized type of graph walker that focuses on traversing and exploring the vertices in a graph.
The VertexWalker
trait provides a set of methods for working with vertices, such as
filtering vertices based on a predicate, limiting the number of vertices returned,
and collecting the vertices into a specific data structure.
Implementors of this trait are responsible for defining the specific graph
representation they work with (via the Graph
associated type) and the
internal state they need to track during the walk (via the Context
associated type).
Required Methods§
Provided Methods§
fn vertices_by_id<Iter>( self, vertex_ids: Iter, ) -> VertexIter<'graph, Self, Iter::IntoIter>
fn vertices<'search>( self, vertex_search: VertexSearch<'search, Self::Graph>, ) -> Vertices<'search, 'graph, Self>
fn filter<Predicate>( self, predicate: Predicate, ) -> VertexFilter<'graph, Self, Predicate>
fn control_flow<Predicate>(
self,
predicate: Predicate,
) -> VertexControlFlow<'graph, Self, Predicate>where
Self: 'graph,
for<'a> Predicate: Fn(&'a <Self::Graph as Graph>::VertexReference<'graph>, &mut Self::Context) -> ControlFlow<Option<&'a <Self::Graph as Graph>::VertexReference<'graph>>, Option<&'a <Self::Graph as Graph>::VertexReference<'graph>>>,
fn take(self, n: usize) -> VertexTake<'graph, Self>
fn detour<Path, Terminal, WalkerBuilder>(
self,
path: Path,
) -> Detour<'graph, Self, Path, Terminal>where
Path: Fn(VertexWalkerBuilder<'graph, ImmutableMarker, Self::Graph, Waypoint<'graph, Self::Graph, Self::Context>>) -> WalkerBuilder,
WalkerBuilder: Into<WalkerBuilder<'graph, ImmutableMarker, Self::Graph, Terminal>>,
Terminal: Walker<'graph, Graph = Self::Graph>,
<Self as Walker<'graph>>::Graph: 'graph,
fn context<Callback, Context>( self, predicate: Callback, ) -> VertexContext<'graph, Self, Callback, Context>
fn edges(self, search: EdgeSearch<'_, Self::Graph>) -> Edges<'_, 'graph, Self>
fn reduce<Reducer>(
self,
reducer: Reducer,
) -> VertexReduce<'graph, Self, Reducer>where
Reducer: for<'a> Fn(&'a <Self::Graph as Graph>::VertexReference<'graph>, &'a <Self::Graph as Graph>::VertexReference<'graph>, &Self::Context) -> &'a <Self::Graph as Graph>::VertexReference<'graph>,
<Self as Walker<'graph>>::Graph: 'graph,
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.