Skip to content

Commit 5a0fba0

Browse files
goropikarisbromberger
authored andcommitted
fix deprecation warning for layout (#57)
1 parent 329ee53 commit 5a0fba0

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

src/layout.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function circular_layout(G)
5757
else
5858
# Discard the extra angle since it matches 0 radians.
5959
θ = linspace(0, 2pi, _nv(G) + 1)[1:end-1]
60-
return cos(θ), sin(θ)
60+
return cos.(θ), sin.(θ)
6161
end
6262
end
6363

@@ -177,7 +177,7 @@ Vector of Vector, Vector of node Vector for each shell.
177177
**Examples**
178178
```
179179
julia> g = graphfamous("karate")
180-
julia> nlist = Array(Vector{Int}, 2)
180+
julia> nlist = Array{Vector{Int}}(2)
181181
julia> nlist[1] = [1:5]
182182
julia> nlist[2] = [6:num_vertiecs(g)]
183183
julia> locs_x, locs_y = shell_layout(g, nlist)
@@ -188,7 +188,7 @@ function shell_layout(G, nlist::Union{Void, Vector{Vector{Int}}} = nothing)
188188
return [0.0], [0.0]
189189
end
190190
if nlist == nothing
191-
nlist = Array(Vector{Int}, 1)
191+
nlist = Array{Vector{Int}}(1)
192192
nlist[1] = collect(1:_nv(G))
193193
end
194194
radius = 0.0
@@ -200,8 +200,8 @@ function shell_layout(G, nlist::Union{Void, Vector{Vector{Int}}} = nothing)
200200
for nodes in nlist
201201
# Discard the extra angle since it matches 0 radians.
202202
θ = linspace(0, 2pi, length(nodes) + 1)[1:end-1]
203-
append!(locs_x, radius*cos(θ))
204-
append!(locs_y, radius*sin(θ))
203+
append!(locs_x, radius*cos.(θ))
204+
append!(locs_y, radius*sin.(θ))
205205
radius += 1.0
206206
end
207207
locs_x, locs_y

src/stress.jl

+4-6
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function stressmajorize_layout(G, p::Int=2, w=nothing, X0=randn(_nv(G), p);
6363

6464
if w==nothing
6565
w = δ.^-2
66-
w[!isfinite(w)] = 0
66+
w[.!isfinite.(w)] = 0
6767
end
6868

6969
@assert size(X0, 1)==size(δ, 1)==size(δ, 2)==size(w, 1)==size(w, 2)
@@ -76,7 +76,7 @@ function stressmajorize_layout(G, p::Int=2, w=nothing, X0=randn(_nv(G), p);
7676
for iter = 1:maxiter
7777
#TODO the faster way is to drop the first row and col from the iteration
7878
X = pinvLw * (LZ(X0, δ, w)*X0)
79-
@assert all(isfinite(X))
79+
@assert all(isfinite.(X))
8080
newstress, oldstress = stress(X, δ, w), newstress
8181
verbose && info("""Iteration $iter
8282
Change in coordinates: $(vecnorm(X - X0))
@@ -109,7 +109,7 @@ function stress(X, d=fill(1.0, size(X, 1), size(X, 1)), w=nothing)
109109
n = size(X, 1)
110110
if w==nothing
111111
w = d.^-2
112-
w[!isfinite(w)] = 0
112+
w[!isfinite.(w)] = 0
113113
end
114114
@assert n==size(d, 1)==size(d, 2)==size(w, 1)==size(w, 2)
115115
for j=1:n, i=1:j-1
@@ -162,8 +162,6 @@ function LZ(Z, d, w)
162162
end
163163
L[i, i] = D
164164
end
165-
@assert all(isfinite(L))
165+
@assert all(isfinite.(L))
166166
L
167167
end
168-
169-

0 commit comments

Comments
 (0)