[][src]Function sfcpl::graph::dfs::dfs

pub fn dfs<'a, G: Graph<'a, NodeId = usize>>(
    g: &'a G,
    start: G::NodeId
) -> Dfs<'a, G>

startからの深さ優先探索時の、 頂点から頂点の接続をイテレートするIteratorを作る

This example is not tested
let e = &[(0, 2), (0, 1), (1, 2), (2, 3), (3, 4), (3, 5), (1, 5)];

let g = make_undirected_graph(6, e);

for (f, t) in dfs(&g, 0) {
    println!("{} -> {}", f, t);
}

これは

0 -> 1

1 -> 5

5 -> 3

3 -> 4

0 -> 2

を表示する