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.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbromberger committed Aug 22, 2018
1 parent 80249ae commit 7ebbd6a
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 @@ -88,6 +88,16 @@ import Random
ga = SimpleGraph(10)
@test @inferred(eltype(SimpleGraph{T}(ga))) == T

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


for gd in testdigraphs(gdx)
U = eltype(gd)
@test @inferred(eltype(SimpleGraph(gd))) == U
Expand Down

0 comments on commit 7ebbd6a

Please sign in to comment.