wolf-graph 0.1.0

Data structures and algorithms for working with graphs with reference or value semantics.
Documentation
use anyhow::Result;

use crate::{EdgeID, NodeID, VisitableGraph};

/// A visitor for depth-first search.
pub trait DFSVisitor {
    type Graph: VisitableGraph;
    type Output: Default;

    fn init_node(&mut self, _graph: &Self::Graph, _node: &NodeID) -> Result<Option<Self::Output>> { Ok(None) }
    fn start_node(&mut self, _graph: &Self::Graph, _node: &NodeID) -> Result<Option<Self::Output>> { Ok(None) }
    fn discover_node(&mut self, _graph: &Self::Graph, _node: &NodeID) -> Result<Option<Self::Output>> { Ok(None) }
    fn finish_node(&mut self, _graph: &Self::Graph, _node: &NodeID) -> Result<Option<Self::Output>> { Ok(None) }
    fn examine_edge(&mut self, _graph: &Self::Graph, _edge: &EdgeID) -> Result<Option<Self::Output>> { Ok(None) }
    fn tree_edge(&mut self, _graph: &Self::Graph, _edge: &EdgeID) -> Result<Option<Self::Output>> { Ok(None) }
    fn back_edge(&mut self, _graph: &Self::Graph, _edge: &EdgeID) -> Result<Option<Self::Output>> { Ok(None) }
    fn forward_or_cross_edge(&mut self, _graph: &Self::Graph, _edge: &EdgeID) -> Result<Option<Self::Output>> { Ok(None) }
    fn finish_edge(&mut self, _graph: &Self::Graph, _edge: &EdgeID) -> Result<Option<Self::Output>> { Ok(None) }

    fn finish(&mut self, _graph: &Self::Graph) -> Result<Self::Output> { Ok(Default::default()) }
}