JuliaGraphs / JuliaGraphs/GraphPlot.jl

Issues making deterministic spring layout

Open
#197 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
213
Forks
62
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the spring_layout methods in src/layout.jl at lines 104 and 177, then reproduce the documented gplot examples from the issue. Trace the accepted arguments and keyword handling to determine how the documented usage diverges from the implementation. Done means the documentation and behavior consistently provide a supported way to make spring layouts deterministic.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.