Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Multiple dispatch was messing up because types were not specified for spring layout and `kws` not preceeded by `;`
  • Loading branch information
hdavid16 committed Jul 27, 2022
1 parent 4d574e0 commit 67bd950
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/layout.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ julia> locs_x, locs_y = spring_layout(g)
```
"""
function spring_layout(g::AbstractGraph,
locs_x=2*rand(nv(g)).-1.0,
locs_y=2*rand(nv(g)).-1.0;
locs_x::Vector{R1}=2*rand(nv(g)).-1.0,
locs_y::Vector{R2}=2*rand(nv(g)).-1.0;
C=2.0,
MAXITER=100,
INITTEMP=2.0)
INITTEMP=2.0) where {R1 <: Real, R2 <: Real}

nvg = nv(g)
adj_matrix = adjacency_matrix(g)
Expand Down Expand Up @@ -174,7 +174,7 @@ end

using Random: MersenneTwister

function spring_layout(g::AbstractGraph, seed::Integer, kws...)
function spring_layout(g::AbstractGraph, seed::Integer; kws...)
rng = MersenneTwister(seed)
spring_layout(g, 2 .* rand(rng, nv(g)) .- 1.0, 2 .* rand(rng,nv(g)) .- 1.0; kws...)
end
Expand Down

0 comments on commit 67bd950

Please sign in to comment.