Closed SimonEnsemble closed 2 months ago
@SimonEnsemble this is fixed in PR #186. However, if you need to make plots where you set the seed, just use GraphMakie (since it is not clear if this PR will be merged at any point):
using Graphs, GraphMakie
using GraphMakie:Spring
graph = SimpleGraph(9)
add_edge!(graph, 1, 2)
add_edge!(graph, 3, 4)
add_edge!(graph, 3, 5)
add_edge!(graph, 4, 5)
add_edge!(graph, 6, 7)
add_edge!(graph, 7, 8)
add_edge!(graph, 8, 9)
graphplot(graph,layout=Spring(seed=97339,C=2.0))
If you just want the locations then run,
loc_x, loc_y = Spring(;C=2.0,seed=97339)(graph)
#9-element Vector{Point2{Float64}}:
# [6.085732446390886, 2.2914171065246642]
# [5.622402183255887, 1.0407819527554754]
# [1.5199667804243207, -8.373001182722112]
# [0.6096922018281642, -7.562980245682519]
# [2.013612134245273, -7.320345707757515]
# [-7.559104906247997, 5.12608753224364]
# [-6.192837350012484, 6.015599417248268]
# [-4.356427140564693, 6.320432042063193]
# [-2.8337673677147994, 6.923911898290827]
the following code fails:
with the error:
but works just fine when I omit the
C=2.0
. (I am setting the random seed as97339
.