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

Commit

Permalink
fixes DiGraph(DiGraph(...)) (#690)
Browse files Browse the repository at this point in the history
Thanks, @juliohm!
  • Loading branch information
sbromberger authored Jul 18, 2017
1 parent da0c350 commit 38b4430
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/graphtypes/simplegraphs/simpledigraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function (::Type{SimpleDiGraph{T}})(g::SimpleDiGraph) where T<:Integer
return SimpleDiGraph(ne(g), h_fadj, h_badj)
end

SimpleDiGraph(g::SimpleDiGraph) = copy(g)

# constructor from abstract graph: DiGraph(graph)
function SimpleDiGraph(g::AbstractSimpleGraph)
Expand Down
3 changes: 3 additions & 0 deletions test/graphtypes/simplegraphs/simplegraphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,11 @@ struct DummySimpleGraph <: AbstractSimpleGraph end

gdx = CompleteDiGraph(4)
for g in testdigraphs(gdx)
h = DiGraph(g)
@test g == h
@test rem_vertex!(g, 2)
@test nv(g) == 3 && ne(g) == 6
@test g != h
end


Expand Down

0 comments on commit 38b4430

Please sign in to comment.