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

SimpleGraph(SimpleGraph) plus tests. #998

Merged
merged 1 commit into from
Aug 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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