From 67bd950938f19c6c00eb5a0ff659745c6a43a1b4 Mon Sep 17 00:00:00 2001 From: hdavid16 Date: Wed, 27 Jul 2022 09:50:55 -0500 Subject: [PATCH] Fix #154 Multiple dispatch was messing up because types were not specified for spring layout and `kws` not preceeded by `;` --- src/layout.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/layout.jl b/src/layout.jl index 5507b89..85320d1 100644 --- a/src/layout.jl +++ b/src/layout.jl @@ -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) @@ -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