Skip to content

Commit 45329b9

Browse files
committed
remove Circular layout, Shell() does the same
1 parent 74279fd commit 45329b9

File tree

5 files changed

+8
-67
lines changed

5 files changed

+8
-67
lines changed

docs/src/index.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,7 @@ nothing #hide
118118
```
119119
![stress animation](stress_animation.mp4)
120120

121-
## Circular Layout
122-
```@docs
123-
Circular
124-
```
125-
```@example layouts
126-
g = smallgraph(:karate)
127-
layout = Circular()
128-
f, ax, p = graphplot(g, layout=layout)
129-
hidedecorations!(ax); hidespines!(ax); ax.aspect = DataAspect(); f #hide
130-
```
131-
132-
## Shell Layout
121+
## Shell/Circular Layout
133122
```@docs
134123
Shell
135124
```

src/NetworkLayout.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ include("buchheim.jl")
101101
include("spring.jl")
102102
include("stress.jl")
103103
include("spectral.jl")
104-
include("circular.jl")
105104
include("shell.jl")
106105
include("squaregrid.jl")
107106

src/circular.jl

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/shell.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ export Shell
44
Shell(; kwargs...)(adj_matrix)
55
layout(algo::Shell, adj_matrix)
66
7-
Position nodes in conenctric circles.
7+
Position nodes in concentric circles. Without further arguments all nodes will
8+
be placed on a circle with radius 1.0. Specify placement of nodes using the
9+
`nlist` argument.
810
911
Takes adjacency matrix representation of a network and returns coordinates of
1012
the nodes.
@@ -13,9 +15,9 @@ the nodes.
1315
- `Ptype=Float64`: Determines the output type `Point{2,Ptype}`.
1416
- `nlist=Vector{Int}[]`
1517
16-
List of node-lists for each shell from inner to outer. Tells the algorithm
17-
which node idx to place on which circle. Nodes which are not present in this
18-
list will be place on additional outermost shell.
18+
Vector of Vector of node indices. Tells the algorithm, which nodes to place on
19+
which shell from inner to outer. Nodes which are not present in this list will
20+
be place on additional outermost shell.
1921
2022
This function started as a copy from [IainNZ](https://github.com/IainNZ)'s [GraphLayout.jl](https://github.com/IainNZ/GraphLayout.jl)
2123
"""
@@ -27,9 +29,6 @@ Shell(; Ptype=Float64, nlist=Vector{Int}[]) = Shell{Ptype}(nlist)
2729

2830
function layout(algo::Shell{Ptype}, adj_matrix::AbstractMatrix) where {Ptype}
2931
N = assertsquare(adj_matrix)
30-
if N == 1
31-
return Point{2,Float64}[Point(0.0, 0.0)]
32-
end
3332

3433
nlist = copy(algo.nlist)
3534

@@ -41,6 +40,7 @@ function layout(algo::Shell{Ptype}, adj_matrix::AbstractMatrix) where {Ptype}
4140
push!(nlist, diff)
4241
end
4342

43+
# if there is more than one node in the innermost shell start with radius 1.0
4444
radius = 0.0
4545
if length(nlist[1]) > 1
4646
radius = 1.0

test/runtests.jl

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -160,24 +160,6 @@ jagmesh_adj = jagmesh()
160160
end
161161
end
162162

163-
@testset "Testing Circular Layout Algorithm" begin
164-
println("Circular wheel_graph")
165-
@testset "Testing wheel_graph" begin
166-
g = wheel_graph(10)
167-
adj_matrix = adjacency_matrix(g)
168-
positions = @time Circular()(adj_matrix)
169-
@test typeof(positions) == Vector{Point{2,Float64}}
170-
positions = @time Circular(; Ptype=Float32)(adj_matrix)
171-
@test typeof(positions) == Vector{Point{2,Float32}}
172-
end
173-
@testset "Testing Base Case" begin
174-
g = Graph(1)
175-
adj_matrix = adjacency_matrix(g)
176-
positions = @time Circular()(adj_matrix)
177-
@test typeof(positions) == Vector{Point{2,Float64}}
178-
end
179-
end
180-
181163
@testset "Testing Shell Layout Algorithm" begin
182164
println("Shell wheel_graph")
183165

@@ -289,7 +271,6 @@ jagmesh_adj = jagmesh()
289271
M2 = rand(4,4)
290272
@test assertsquare(M2) == 4
291273
@test_throws ArgumentError layout(Buchheim(), M1)
292-
@test_throws ArgumentError layout(Circular(), M1)
293274
@test_throws ArgumentError layout(SFDP(), M1)
294275
@test_throws ArgumentError layout(Shell(), M1)
295276
@test_throws ArgumentError layout(Spectral(), M1)

0 commit comments

Comments
 (0)