From 4c1f900c3b26a07ff27b7145771d8c13888e8d67 Mon Sep 17 00:00:00 2001 From: hdavid16 Date: Wed, 27 Jul 2022 11:18:59 -0500 Subject: [PATCH] fixed #149 --- src/layout.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/layout.jl b/src/layout.jl index 2a9956b..0bac592 100644 --- a/src/layout.jl +++ b/src/layout.jl @@ -205,20 +205,20 @@ function shell_layout(g, nlist::Union{Nothing, Vector{Vector{Int}}} = nothing) if nv(g) == 1 return [0.0], [0.0] end - if nlist == nothing + if isnothing(nlist) nlist = [collect(1:nv(g))] end radius = 0.0 if length(nlist[1]) > 1 radius = 1.0 end - locs_x = Float64[] - locs_y = Float64[] + locs_x = zeros(nv(g)) + locs_y = zeros(nv(g)) for nodes in nlist # Discard the extra angle since it matches 0 radians. θ = range(0, stop=2pi, length=length(nodes)+1)[1:end-1] - append!(locs_x, radius*cos.(θ)) - append!(locs_y, radius*sin.(θ)) + locs_x[nodes] = radius*cos.(θ) + locs_y[nodes] = radius*sin.(θ) radius += 1.0 end return locs_x, locs_y