Skip to content

Commit

Permalink
new syntax for graph generators
Browse files Browse the repository at this point in the history
  • Loading branch information
matbesancon committed Jan 15, 2020
1 parent f06d920 commit ec0a7ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ version = "0.1.0"
LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d"

[compat]
LightGraphs = "1.3"
julia = "1"
LightGraphs = "1"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "Random"]
14 changes: 6 additions & 8 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const LG = LightGraphs
@test LG.add_edge!(g1, 1, 3)
@test LG.ne(g1) == 2 == LG.ne(g1_copy) + 1

g2_inner = LG.CompleteGraph(nv)
g2_inner = LG.complete_graph(nv)
g2 = VSafeGraph(g2_inner)
@test LG.nv(g2) == LG.nv(g2_inner)
@test LG.ne(g2) == LG.ne(g2_inner)
Expand All @@ -29,7 +29,7 @@ const LG = LightGraphs
@test LG.has_edge(g2, LG.SimpleEdge(1, 2))
@test LG.edgetype(g2) == LG.edgetype(g2_inner)

g3 = VSafeGraph(LG.CompleteDiGraph(30))
g3 = VSafeGraph(LG.complete_digraph(30))
@test !LG.add_edge!(g3, 1, 2) # no possible addition on a complete graph
@test !LG.add_edge!(g3, LG.SimpleEdge(1, 2))
@test LG.is_directed(g3)
Expand All @@ -42,7 +42,7 @@ end
@testset "Vertex deletion" begin
Random.seed!(33)
nv = 45
inner = LG.CompleteGraph(nv)
inner = LG.complete_graph(nv)
g = VSafeGraph(inner)
@test LG.ne(inner) == LG.ne(g)
@test LG.nv(inner) == LG.nv(g)
Expand All @@ -68,7 +68,7 @@ end
@testset "Edge addition" begin
Random.seed!(45)
nv = 10
inner = LG.CompleteGraph(nv)
inner = LG.complete_graph(nv)
g = VSafeGraph(inner)
nea = 0 #number of edges added
nrv = 0 #number of removed vertices
Expand Down Expand Up @@ -100,7 +100,7 @@ end
@testset "Neighbor sets" begin
Random.seed!(99)
nv = 10
inner = LG.CompleteGraph(nv)
inner = LG.complete_graph(nv)
g = VSafeGraph(inner)
nrv = 0
for _ in 1:5
Expand All @@ -122,11 +122,9 @@ end
end
end



@testset "Generic LG algorithms work" begin
nv = 45
inner = LG.CompleteGraph(nv)
inner = LG.complete_graph(nv)
g = VSafeGraph(inner)
removed_ok = LG.rem_vertex!(g, rand(1:nv))
@test removed_ok
Expand Down

0 comments on commit ec0a7ce

Please sign in to comment.