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

Commit

Permalink
fixes reverse (#994)
Browse files Browse the repository at this point in the history
We will probably want to move this into SimpleGraphs at some point, but until then, I think this is good.
  • Loading branch information
sbromberger authored Aug 19, 2018
1 parent feb1fbc commit cbf8635
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/SimpleGraphs/SimpleGraphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using LinearAlgebra
using LightGraphs

import Base:
eltype, show, ==, Pair, Tuple, copy, length, issubset, zero, in, iterate
eltype, show, ==, Pair, Tuple, copy, length, issubset, reverse, zero, in, iterate

import LightGraphs:
_NI, AbstractGraph, AbstractEdge, AbstractEdgeIter,
Expand Down Expand Up @@ -159,7 +159,7 @@ function rem_vertex!(g::AbstractSimpleGraph, v::Integer)
end

zero(g::T) where T<:AbstractSimpleGraph = T()

include("./simpleedge.jl")
include("./simpledigraph.jl")
include("./simplegraph.jl")
Expand Down
4 changes: 2 additions & 2 deletions src/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ original directed graph.
Preserves the eltype of the input graph.
"""
function reverse end
@traitfn function reverse(g::::IsDirected)
@traitfn function reverse(g::G::IsDirected) where G<:AbstractSimpleGraph
gnv = nv(g)
gne = ne(g)
h = SimpleDiGraph(gnv)
Expand All @@ -57,7 +57,7 @@ end
In-place reverse of a directed graph (modifies the original graph).
"""
function reverse! end
@traitfn function reverse!(g::::IsDirected)
@traitfn function reverse!(g::G::IsDirected) where G<:AbstractSimpleGraph
g.fadjlist, g.badjlist = g.badjlist, g.fadjlist
return g
end
Expand Down

0 comments on commit cbf8635

Please sign in to comment.