From cbf86357a54594e933ef289eb53ba8aeeee0d2e0 Mon Sep 17 00:00:00 2001 From: Seth Bromberger Date: Sun, 19 Aug 2018 12:52:14 -0700 Subject: [PATCH] fixes reverse (#994) We will probably want to move this into SimpleGraphs at some point, but until then, I think this is good. --- src/SimpleGraphs/SimpleGraphs.jl | 4 ++-- src/operators.jl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SimpleGraphs/SimpleGraphs.jl b/src/SimpleGraphs/SimpleGraphs.jl index 5f757fc43..ad10e23ee 100644 --- a/src/SimpleGraphs/SimpleGraphs.jl +++ b/src/SimpleGraphs/SimpleGraphs.jl @@ -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, @@ -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") diff --git a/src/operators.jl b/src/operators.jl index cca4c03cd..257bd79fd 100644 --- a/src/operators.jl +++ b/src/operators.jl @@ -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) @@ -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