Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
SimpleGraph(SimpleGraph) plus tests. (#998)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbromberger authored Aug 22, 2018
1 parent 80249ae commit aeb1652
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/SimpleGraphs/simplegraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ end
# SimpleGraph()
SimpleGraph() = SimpleGraph{Int}()

# SimpleGraph of a SimpleGraph
SimpleGraph(g::SimpleGraph) = copy(g)

# SimpleGraph(6), SimpleGraph(0x5)
SimpleGraph(n::T) where T <: Integer = SimpleGraph{T}(n)

Expand Down
10 changes: 10 additions & 0 deletions test/simplegraphs/simplegraphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@ import Random
@test @inferred(has_edge(g, e))
end

gx = CompleteGraph(4)
for g in testgraphs(gx)
h = Graph(g)
@test g == h
@test rem_vertex!(g, 2)
@test nv(g) == 3 && ne(g) == 3
@test g != h
end


gdx = CompleteDiGraph(4)
for g in testdigraphs(gdx)
h = DiGraph(g)
Expand Down

0 comments on commit aeb1652

Please sign in to comment.