Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues making deterministic spring layout #197

Open
astenuz opened this issue Nov 30, 2023 · 1 comment
Open

Issues making deterministic spring layout #197

astenuz opened this issue Nov 30, 2023 · 1 comment

Comments

@astenuz
Copy link

astenuz commented Nov 30, 2023

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
Copy link
Contributor

I believe this would get fixed with the following PR, which hasn't been reviewed yet: #186

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants