JuliaGraphs / GraphPlot.jl

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

Issues making deterministic spring layout #197

Open astenuz opened 11 months ago

astenuz commented 11 months ago

The documentation mentions a parameter seed for spring_layout which does not exist. In addition, this is also the method that is referenced in the documentation to change spring_layout default parameters.

layout=(args...) -> spring_layout(args...; C=2, seed=1)   #this fails as the method does not accept seed
gplot(g, layout=layout)

There is a method that accepts a graph and a seed, but this one calls spring_layout directly and does not return a function that gplot expects. I tried to do this but it fails

layout=(kws...) -> spring_layout(g, seed=1, kws...)
gplot(g, layout=layout)

Giving error

MethodError: no method matching spring_layout(::Graphs.SimpleGraphs.SimpleGraph{Int64}, ::Graphs.SimpleGraphs.SimpleGraph{Int64}, ::Vector{Float64}; seed::Int64)

Closest candidates are:

spring_layout(::Graphs.AbstractGraph, ::Any, ::Any; C, MAXITER, INITTEMP) got unsupported keyword argument "seed"

@ GraphPlot ~/.julia/packages/GraphPlot/HXIna/src/layout.jl:104

spring_layout(::Graphs.AbstractGraph, !Matched::Integer, ::Any...) got unsupported keyword argument "seed"

@ GraphPlot ~/.julia/packages/GraphPlot/HXIna/src/layout.jl:177

spring_layout(::Graphs.AbstractGraph, ::Any) got unsupported keyword argument "seed"

@ GraphPlot ~/.julia/packages/GraphPlot/HXIna/src/layout.jl:104

It is unclear then how to make spring layout deterministic

hdavid16 commented 11 months ago

I believe this would get fixed with the following PR, which hasn't been reviewed yet: https://github.com/JuliaGraphs/GraphPlot.jl/pull/186