JuliaGraphs / GraphPlot.jl

Graph visualization for Julia.
http://JuliaGraphs.github.io/GraphPlot.jl/
Other
200 stars 62 forks source link

Regression with SimpleWeightedDiGraph #189

Closed Lecrapouille closed 1 year ago

Lecrapouille commented 1 year ago

Following https://github.com/JuliaGraphs/GraphPlot.jl/issues/120 but on Julia 1.8.x

using SparseArrays, Graphs, SimpleWeightedGraphs, GraphPlot

g = smallgraph(:karate)
gplot(g) # working !!!

A = [2.0 3; 4 7]
sA = sparse(A)

G1 = SimpleWeightedDiGraph(A)
gplot(G1) # Not working

G2 = SimpleWeightedDiGraph(sA)
gplot(G2) # Not working

I have this error:

MethodError: no method matching spring_layout(::SimpleWeightedDiGraph{Int64, Float64})
Closest candidates are:
  spring_layout(::AbstractGraph) at ~/.julia/packages/GraphPlot/HXIna/src/layout.jl:104
  spring_layout(::AbstractGraph, ::Integer, ::Any...) at ~/.julia/packages/GraphPlot/HXIna/src/layout.jl:177
  spring_layout(::AbstractGraph, ::Any) at ~/.julia/packages/GraphPlot/HXIna/src/layout.jl:104
simonschoelly commented 1 year ago

Huh, this is weird, as, as SimpleWeightedDiGraph is an AbstractGraph. Is it possible that you are using either an older version of GraphPlot.jl or SimpleWeightedGraphs.jl that still use LightGraphs.jl instead of Graphs.jl?

Can you enter ]status in your Julia REPL and paste the output here?

Lecrapouille commented 1 year ago

Sorry, I removed my .julia folder and installed back all packages and now it seems working well