Skip to content

Issues making deterministic spring layout #197

@astenuz

Description

@astenuz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions