wolf_graph/algo/
dfs_visitor.rs1use anyhow::Result;
2
3use crate::{EdgeID, NodeID, VisitableGraph};
4
5pub trait DFSVisitor {
7 type Graph: VisitableGraph;
8 type Output: Default;
9
10 fn init_node(&mut self, _graph: &Self::Graph, _node: &NodeID) -> Result<Option<Self::Output>> { Ok(None) }
11 fn start_node(&mut self, _graph: &Self::Graph, _node: &NodeID) -> Result<Option<Self::Output>> { Ok(None) }
12 fn discover_node(&mut self, _graph: &Self::Graph, _node: &NodeID) -> Result<Option<Self::Output>> { Ok(None) }
13 fn finish_node(&mut self, _graph: &Self::Graph, _node: &NodeID) -> Result<Option<Self::Output>> { Ok(None) }
14 fn examine_edge(&mut self, _graph: &Self::Graph, _edge: &EdgeID) -> Result<Option<Self::Output>> { Ok(None) }
15 fn tree_edge(&mut self, _graph: &Self::Graph, _edge: &EdgeID) -> Result<Option<Self::Output>> { Ok(None) }
16 fn back_edge(&mut self, _graph: &Self::Graph, _edge: &EdgeID) -> Result<Option<Self::Output>> { Ok(None) }
17 fn forward_or_cross_edge(&mut self, _graph: &Self::Graph, _edge: &EdgeID) -> Result<Option<Self::Output>> { Ok(None) }
18 fn finish_edge(&mut self, _graph: &Self::Graph, _edge: &EdgeID) -> Result<Option<Self::Output>> { Ok(None) }
19
20 fn finish(&mut self, _graph: &Self::Graph) -> Result<Self::Output> { Ok(Default::default()) }
21}