reverse_traverse_mut

Function reverse_traverse_mut 

Source
pub fn reverse_traverse_mut<N, E, F, T, Err>(
    graph: &mut StableGraph<N, E>,
    callback: F,
) -> Result<(), Err>
where N: Clone, E: Clone, T: TransformList<N, E>, F: FnMut(GraphQuery<'_, N, E>, NodeIndex) -> Result<T, Err>,
Expand description

A specialized reverse topological DAG traversal that allows the following graph mutations during traversal:

  • Delete the current node
  • Insert nodes after current node
  • Add new nodes with no dependencies

Any other graph mutation will likely result in unvisited nodes.

  • callback: A closure that receives the current node index and an object allowing you to make graph queries. This closure returns a
    transform list or an error. On success, reverse_traverse will apply these transformations before continuing the traversal. Errors will be propagated to the caller.