Skip to content

Commit f407ac5

Browse files
committed
Add two simple tests for DFS traversal
1 parent 42013bc commit f407ac5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/test_abstractgraph.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ using NamedGraphs
3939
@test vertex_path(ng2, (1, 1, 2), (1, 1, 1)) == [(1, 1, 2), (1, 1), (1, 1, 1)]
4040
@test edge_path(ng2, (1, 1, 2), (1, 1, 1)) ==
4141
[net2((1, 1, 2), (1, 1)), net2((1, 1), (1, 1, 1))]
42+
# Test DFS traversals
43+
@test post_order_dfs_vertices(ng2, (1,)) ==
44+
[(1, 1, 1), (1, 1, 2), (1, 1), (1, 2, 1), (1, 2, 2), (1, 2), (1,)]
45+
@test pre_order_dfs_vertices(ng2, (1,)) ==
46+
[(1,), (1, 1), (1, 1, 1), (1, 1, 2), (1, 2), (1, 2, 1), (1, 2, 2)]
4247

4348
# directed trees
4449
dg1 = dfs_tree(g1, 5)

0 commit comments

Comments
 (0)