pub fn dfs<T: Clone + Eq + Hash, U, F, G, E>(
start: &T,
visiteds: &mut HashSet<T>,
data: &mut U,
f: F,
g: G,
) -> Result<DfsResult<T>, E>Expand description
This function is an implementation of DFS algorithm with a cycle detection.
A graph is depth-first searched by this function. This function returns a path with the cycle if this function detects a cycle in the graph, otherwise returns a success.