Skip to content

Commit 6a3eaeb

Browse files
authored
Merge pull request #1 from hdavid16/fix_shell_layout
fixed JuliaGraphs#149
2 parents 52f4aae + 4c1f900 commit 6a3eaeb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/layout.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,20 +205,20 @@ function shell_layout(g, nlist::Union{Nothing, Vector{Vector{Int}}} = nothing)
205205
if nv(g) == 1
206206
return [0.0], [0.0]
207207
end
208-
if nlist == nothing
208+
if isnothing(nlist)
209209
nlist = [collect(1:nv(g))]
210210
end
211211
radius = 0.0
212212
if length(nlist[1]) > 1
213213
radius = 1.0
214214
end
215-
locs_x = Float64[]
216-
locs_y = Float64[]
215+
locs_x = zeros(nv(g))
216+
locs_y = zeros(nv(g))
217217
for nodes in nlist
218218
# Discard the extra angle since it matches 0 radians.
219219
θ = range(0, stop=2pi, length=length(nodes)+1)[1:end-1]
220-
append!(locs_x, radius*cos.(θ))
221-
append!(locs_y, radius*sin.(θ))
220+
locs_x[nodes] = radius*cos.(θ)
221+
locs_y[nodes] = radius*sin.(θ)
222222
radius += 1.0
223223
end
224224
return locs_x, locs_y

0 commit comments

Comments
 (0)