Skip to main content

dfs_order

Function dfs_order 

Source
pub fn dfs_order(graph: &[Vec<usize>], source: usize) -> Vec<usize>
Expand description

Return the DFS visitation order starting from source.

Iterative implementation using an explicit stack, so it is safe for graphs deeper than the default Rust stack limit.

ยงPanics

Panics if source >= graph.len().