|
1 | 1 | @testset "DFS" begin
|
2 |
| - |
| 2 | + gnodes_directed=SimpleDiGraph(4) |
| 3 | + gnodes_undirected=SimpleGraph(4) |
| 4 | + gloop_directed=SimpleDiGraph(1) |
| 5 | + add_edge!(gloop_directed, 1, 1); |
| 6 | + gloop_undirected=SimpleGraph(1) |
| 7 | + add_edge!(gloop_undirected, 1, 1); |
3 | 8 | g5 = SimpleDiGraph(4)
|
4 | 9 | add_edge!(g5, 1, 2); add_edge!(g5, 2, 3); add_edge!(g5, 1, 3); add_edge!(g5, 3, 4)
|
5 | 10 | gx = cycle_digraph(3)
|
6 |
| - |
| 11 | + gcyclic = SimpleGraph([0 1 1 0 0; 1 0 1 0 0; 1 1 0 0 0; 0 0 0 0 1; 0 0 0 1 0]) |
| 12 | + gtree = SimpleGraph([0 1 1 1 0 0 0; 1 0 0 0 0 0 0; 1 0 0 0 0 0 0; 1 0 0 0 1 1 1; 0 0 0 1 0 0 0; 0 0 0 1 0 0 0; 0 0 0 1 0 0 0]) |
7 | 13 | @testset "dfs_tree" begin
|
8 | 14 | for g in testdigraphs(g5)
|
9 | 15 | z = @inferred(dfs_tree(g, 1))
|
|
26 | 32 |
|
27 | 33 | @testset "is_cyclic" begin
|
28 | 34 | for g in testgraphs(path_graph(2))
|
| 35 | + @test !@inferred(is_cyclic(g)) |
| 36 | + @test !@inferred(is_cyclic(zero(g))) |
| 37 | + end |
| 38 | + for g in testgraphs(gcyclic) |
| 39 | + @test @inferred(is_cyclic(g)) |
| 40 | + end |
| 41 | + for g in testgraphs(gtree) |
| 42 | + @test !@inferred(is_cyclic(g)) |
| 43 | + end |
| 44 | + for g in testgraphs(g5) |
| 45 | + @test !@inferred(is_cyclic(g)) |
| 46 | + end |
| 47 | + for g in testgraphs(gnodes_directed) |
| 48 | + @test !@inferred(is_cyclic(g)) |
| 49 | + end |
| 50 | + for g in testgraphs(gnodes_undirected) |
| 51 | + @test !@inferred(is_cyclic(g)) |
| 52 | + end |
| 53 | + for g in testgraphs(gloop_directed) |
| 54 | + @test @inferred(is_cyclic(g)) |
| 55 | + end |
| 56 | + for g in testgraphs(gloop_undirected) |
29 | 57 | @test @inferred(is_cyclic(g))
|
30 |
| - @test @inferred(!is_cyclic(zero(g))) |
31 | 58 | end
|
32 | 59 | end
|
33 | 60 |
|
|
0 commit comments