pub struct Walk<'a, N> { /* private fields */ }Expand description
A walk standing on a set of nodes of one type.
Each hop is a whole frontier at a time, and the frontier is a set, so a
diamond in the graph does not turn into two copies of the node at the far
end. See Graph::walk.
Implementations§
Source§impl<'a, N: Node> Walk<'a, N>
impl<'a, N: Node> Walk<'a, N>
Sourcepub fn out<E: Edge<From = N>>(self) -> Result<Walk<'a, E::To>>
pub fn out<E: Edge<From = N>>(self) -> Result<Walk<'a, E::To>>
Follow every edge of this kind forwards.
E::From is N, which is what makes a hop the graph does not have a
compile error rather than an empty answer.
§Errors
Code::Invalid if called from inside a callback holding this database.
Sourcepub fn incoming<E: Edge<To = N>>(self) -> Result<Walk<'a, E::From>>
pub fn incoming<E: Edge<To = N>>(self) -> Result<Walk<'a, E::From>>
Follow every edge of this kind backwards.
§Errors
Code::Invalid if called from inside a callback holding this database.
Sourcepub fn filter(self, keep: impl FnMut(&N) -> bool) -> Result<Walk<'a, N>>
pub fn filter(self, keep: impl FnMut(&N) -> bool) -> Result<Walk<'a, N>>
Keep only the nodes that pass.
The node is read to be looked at, so this is the expensive filter and it belongs at the end of a walk rather than in the middle of one.
§Errors
Code::Corrupt if a node on the walk is not an N.