Skip to content

Commit 615b7f4

Browse files
again
1 parent 66cda88 commit 615b7f4

File tree

5 files changed

+23
-25
lines changed

5 files changed

+23
-25
lines changed

src/GraphRecipes.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
Graphs
21
module GraphRecipes
32

4-
using LightGraphs
3+
using Graphs
54
import NetworkLayout
65
using PlotUtils # ColorGradient
76
using RecipesBase

src/graphs.jl

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Graphsconst _graph_funcs = Dict{Symbol,Any}(
1+
const _graph_funcs = Dict{Symbol,Any}(
22
:spectral => spectral_graph,
33
:sfdp => sfdp_graph,
44
:circular => circular_graph,
@@ -162,14 +162,14 @@ function compute_laplacian(adjmat::AbstractMatrix, node_weights::AbstractVector)
162162
L, D
163163
end
164164

165-
import LightGraphs
165+
import Graphs
166166

167167
# TODO: so much wasteful conversion... do better
168168
function estimate_distance(adjmat::AbstractMatrix)
169169
source, destiny, weights = get_source_destiny_weight(sparse(adjmat))
170170

171-
g = LightGraphs.Graph(adjmat)
172-
dists = convert(Matrix{Float64}, hcat(map(i->LightGraphs.dijkstra_shortest_paths(g, i).dists, LightGraphs.vertices(g))...))
171+
g = Graphs.Graph(adjmat)
172+
dists = convert(Matrix{Float64}, hcat(map(i->Graphs.dijkstra_shortest_paths(g, i).dists, Graphs.vertices(g))...))
173173
tot = 0.0; cnt = 0
174174
for (i,d) in enumerate(dists)
175175
if d < 1e10
@@ -186,27 +186,27 @@ function estimate_distance(adjmat::AbstractMatrix)
186186
dists
187187
end
188188

189-
function get_source_destiny_weight(g::LightGraphs.AbstractGraph)
189+
function get_source_destiny_weight(g::Graphs.AbstractGraph)
190190
source = Vector{Int}()
191191
destiny = Vector{Int}()
192-
sizehint!(source, LightGraphs.nv(g))
193-
sizehint!(destiny, LightGraphs.nv(g))
194-
for e in LightGraphs.edges(g)
195-
push!(source, LightGraphs.src(e))
196-
push!(destiny, LightGraphs.dst(e))
192+
sizehint!(source, Graphs.nv(g))
193+
sizehint!(destiny, Graphs.nv(g))
194+
for e in Graphs.edges(g)
195+
push!(source, Graphs.src(e))
196+
push!(destiny, Graphs.dst(e))
197197
end
198198
get_source_destiny_weight(source, destiny)
199199
end
200200

201-
function get_adjacency_matrix(g::LightGraphs.AbstractGraph)
201+
function get_adjacency_matrix(g::Graphs.AbstractGraph)
202202
adjacency_matrix(g)
203203
end
204204

205205
function get_adjacency_matrix(source::AbstractVector{Int}, destiny::AbstractVector{Int})
206206
get_adjacency_matrix(source, destiny, ones(length(source)))
207207
end
208208

209-
function get_adjacency_list(g::LightGraphs.AbstractGraph)
209+
function get_adjacency_list(g::Graphs.AbstractGraph)
210210
g.fadjlist
211211
end
212212

@@ -243,7 +243,7 @@ const graph_aliases = Dict(:curvature_scalar => [:curvaturescalar,:curvature],
243243
graphplot(g; kwargs...)
244244
245245
Visualize the graph `g`, where `g` represents a graph via a matrix or a
246-
`LightGraphs.graph`.
246+
`Graphs.graph`.
247247
## Keyword arguments
248248
```
249249
dim = 2
@@ -325,12 +325,12 @@ more details.
325325
edgecolor = :black,
326326
edgestyle = :solid,
327327
)
328-
# Process the args so that they are a LightGraphs.Graph.
329-
if length(g.args) <= 1 && !(eltype(g.args[1]) <: AbstractArray) && !(g.args[1] isa LightGraphs.AbstractGraph) && method != :chorddiagram && method != :arcdiagram
328+
# Process the args so that they are a Graphs.Graph.
329+
if length(g.args) <= 1 && !(eltype(g.args[1]) <: AbstractArray) && !(g.args[1] isa Graphs.AbstractGraph) && method != :chorddiagram && method != :arcdiagram
330330
if !LinearAlgebra.issymmetric(g.args[1]) || any(diag(g.args[1]) .!= zeros(length(diag(g.args[1]))))
331-
g.args = (LightGraphs.DiGraph(g.args[1]),)
331+
g.args = (Graphs.DiGraph(g.args[1]),)
332332
elseif LinearAlgebra.issymmetric(g.args[1])
333-
g.args = (LightGraphs.Graph(g.args[1]),)
333+
g.args = (Graphs.Graph(g.args[1]),)
334334
end
335335
end
336336

src/utils.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
Graphs
21
"""
32
This function builds a BezierCurve which leaves point p vertically upwards and
43
arrives point q vertically upwards. It may create a loop if necessary.
@@ -231,7 +230,7 @@ end
231230
function process_edge_attribute(attr, source, destiny, weights)
232231
if isnothing(attr) || (attr isa Symbol)
233232
return attr
234-
elseif attr isa LightGraphs.AbstractGraph
233+
elseif attr isa Graphs.AbstractGraph
235234
mat = incidence_matrix(attr)
236235
attr = [mat[si, di] for (si, di) in zip(source, destiny)][:] |> permutedims
237236
elseif attr isa Function

test/figures.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
Graphsusing StableRNGs
1+
using StableRNGs
22
using VisualRegressionTests
33
using LinearAlgebra
44
using SparseArrays
55
using ImageMagick
6-
using LightGraphs
6+
using Graphs
77
using AbstractTrees
88

99
cd(@__DIR__)

test/generate_figures.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
Graphsusing StableRNGs
1+
GraphsGraphsusing StableRNGs
22
using LinearAlgebra
33
using SparseArrays
44
using GraphRecipes
55
using Plots
6-
using LightGraphs
6+
using Graphs
77
using AbstractTrees
88

99
cd(@__DIR__)

0 commit comments

Comments
 (0)