pub fn dfs_recursive(g: &Graph, start: usize) -> Vec<usize>Expand description
DFS ning rekursiv ko’rinishi — g’oyani ko’rsatish uchun.
§Misol
use rust_algorithms::graph::{Graph, dfs, dfs_recursive};
let mut g = Graph::new_undirected(5);
for (a, b) in [(0, 1), (1, 2), (0, 3), (3, 4)] {
g.add_unweighted_edge(a, b);
}
assert_eq!(dfs_recursive(&g, 0), dfs(&g, 0));