@@ -76,7 +76,7 @@ function graphline(g::AbstractGraph{T}, locs_x, locs_y, nodesize::Real) where {T
76
76
end
77
77
78
78
function graphcurve (g:: AbstractGraph{T} , locs_x, locs_y, nodesize:: Vector{<:Real} , arrowlength, angleoffset, outangle= pi / 5 ) where {T<: Integer }
79
- curves = Vector {Vector{ Tuple{Float64,Float64}}} (undef, ne (g))
79
+ curves = Matrix { Tuple{Float64,Float64}} (undef, ne (g), 4 )
80
80
arrows = Array {Vector{Tuple{Float64,Float64}}} (undef, ne (g))
81
81
for (e_idx, e) in enumerate (edges (g))
82
82
i = src (e)
@@ -95,16 +95,16 @@ function graphcurve(g::AbstractGraph{T}, locs_x, locs_y, nodesize::Vector{<:Real
95
95
d = 2 * π * nodesize[i]
96
96
end
97
97
98
- curves[e_idx] = curveedge (startx, starty, endx, endy, θ, outangle, d)
98
+ curves[e_idx, : ] = curveedge (startx, starty, endx, endy, θ, outangle, d)
99
99
100
100
arr1, arr2 = arrowcoords (θ- outangle, endx, endy, arrowlength, angleoffset)
101
101
arrows[e_idx] = [arr1, (endx, endy), arr2]
102
102
end
103
- return vcat .( curves... ) , arrows
103
+ return curves, arrows
104
104
end
105
105
106
106
function graphcurve (g, locs_x, locs_y, nodesize:: Real , arrowlength, angleoffset, outangle= pi / 5 )
107
- curves = Vector {Vector{ Tuple{Float64,Float64}}} (undef, ne (g))
107
+ curves = Matrix { Tuple{Float64,Float64}} (undef, ne (g), 4 )
108
108
arrows = Array {Vector{Tuple{Float64,Float64}}} (undef, ne (g))
109
109
for (e_idx, e) in enumerate (edges (g))
110
110
i = src (e)
@@ -123,16 +123,16 @@ function graphcurve(g, locs_x, locs_y, nodesize::Real, arrowlength, angleoffset,
123
123
d = 2 * π * nodesize
124
124
end
125
125
126
- curves[e_idx] = curveedge (startx, starty, endx, endy, θ, outangle, d)
126
+ curves[e_idx, : ] = curveedge (startx, starty, endx, endy, θ, outangle, d)
127
127
128
128
arr1, arr2 = arrowcoords (θ- outangle, endx, endy, arrowlength, angleoffset)
129
129
arrows[e_idx] = [arr1, (endx, endy), arr2]
130
130
end
131
- return vcat .( curves... ) , arrows
131
+ return curves, arrows
132
132
end
133
133
134
134
function graphcurve (g, locs_x, locs_y, nodesize:: Real , outangle)
135
- curves = Vector {Vector{ Tuple{Float64,Float64}}} (undef, ne (g))
135
+ curves = Matrix { Tuple{Float64,Float64}} (undef, ne (g), 4 )
136
136
for (e_idx, e) in enumerate (edges (g))
137
137
i = src (e)
138
138
j = dst (e)
@@ -150,13 +150,13 @@ function graphcurve(g, locs_x, locs_y, nodesize::Real, outangle)
150
150
d = 2 * π * nodesize
151
151
end
152
152
153
- curves[e_idx] = curveedge (startx, starty, endx, endy, θ, outangle, d)
153
+ curves[e_idx, : ] = curveedge (startx, starty, endx, endy, θ, outangle, d)
154
154
end
155
- return vcat .( curves... )
155
+ return curves
156
156
end
157
157
158
158
function graphcurve (g:: AbstractGraph{T} , locs_x, locs_y, nodesize:: Vector{<:Real} , outangle) where {T<: Integer }
159
- curves = Vector {Vector{ Tuple{Float64,Float64}}} (undef, ne (g))
159
+ curves = Matrix { Tuple{Float64,Float64}} (undef, ne (g), 4 )
160
160
for (e_idx, e) in enumerate (edges (g))
161
161
i = src (e)
162
162
j = dst (e)
@@ -174,9 +174,9 @@ function graphcurve(g::AbstractGraph{T}, locs_x, locs_y, nodesize::Vector{<:Real
174
174
d = 2 * π * nodesize[i]
175
175
end
176
176
177
- curves[e_idx] = curveedge (startx, starty, endx, endy, θ, outangle, d)
177
+ curves[e_idx, : ] = curveedge (startx, starty, endx, endy, θ, outangle, d)
178
178
end
179
- return vcat .( curves... )
179
+ return curves
180
180
end
181
181
182
182
# this function is copy from [IainNZ](https://github.com/IainNZ)'s [GraphLayout.jl](https://github.com/IainNZ/GraphLayout.jl)
@@ -199,5 +199,5 @@ function curveedge(x1, y1, x2, y2, θ, outangle, d; k=0.5)
199
199
xc2 = x2 + r * cos (θ + π - outangle)
200
200
yc2 = y2 + r * sin (θ + π - outangle)
201
201
202
- return [(x1,y1), (xc1, yc1), (xc2, yc2), (x2, y2)]
202
+ return [(x1,y1) (xc1, yc1) (xc2, yc2) (x2, y2)]
203
203
end
0 commit comments