Skip to content

Commit 574897a

Browse files
committed
avoid use of internal fields (changes .mutable to ismutable)
1 parent fc6ba78 commit 574897a

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

src/Experimental/ShortestPaths/johnson.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ function shortest_paths(g::AbstractGraph{U}, distmx::AbstractMatrix{T}, ::Johnso
2525
type_distmx = typeof(distmx)
2626
#Change when parallel implementation of Bellman Ford available
2727
wt_transform = Graphs.Experimental.ShortestPaths.dists(shortest_paths(g, vertices(g), distmx, BellmanFord()))
28-
29-
if !type_distmx.mutable && type_distmx != Graphs.DefaultDistance
28+
29+
if !ismutable(type_distmx) && type_distmx != Graphs.DefaultDistance
3030
distmx = sparse(distmx) #Change reference, not value
3131
end
3232

3333
#Weight transform not needed if all weights are positive.
3434
if type_distmx != Graphs.DefaultDistance
3535
for e in edges(g)
36-
distmx[src(e), dst(e)] += wt_transform[src(e)] - wt_transform[dst(e)]
36+
distmx[src(e), dst(e)] += wt_transform[src(e)] - wt_transform[dst(e)]
3737
end
3838
end
3939

@@ -51,7 +51,7 @@ function shortest_paths(g::AbstractGraph{U}, distmx::AbstractMatrix{T}, ::Johnso
5151
dists[:, v] .+= wt_transform[v] #Vertical traversal prefered
5252
end
5353

54-
if type_distmx.mutable
54+
if ismutable(type_distmx)
5555
for e in edges(g)
5656
distmx[src(e), dst(e)] += wt_transform[dst(e)] - wt_transform[src(e)]
5757
end

src/Parallel/shortestpaths/johnson.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ distmx::AbstractMatrix{T}=weights(g)) where T <: Real where U <: Integer
66
#Change when parallel implementation of Bellman Ford available
77
wt_transform = bellman_ford_shortest_paths(g, vertices(g), distmx).dists
88

9-
if !type_distmx.mutable && type_distmx != Graphs.DefaultDistance
9+
if !ismutable(type_distmx) && type_distmx != Graphs.DefaultDistance
1010
distmx = sparse(distmx) #Change reference, not value
1111
end
1212

1313
#Weight transform not needed if all weights are positive.
1414
if type_distmx != Graphs.DefaultDistance
1515
for e in edges(g)
16-
distmx[src(e), dst(e)] += wt_transform[src(e)] - wt_transform[dst(e)]
16+
distmx[src(e), dst(e)] += wt_transform[src(e)] - wt_transform[dst(e)]
1717
end
1818
end
1919

@@ -28,12 +28,11 @@ distmx::AbstractMatrix{T}=weights(g)) where T <: Real where U <: Integer
2828
dists[:, v] .+= wt_transform[v] #Vertical traversal prefered
2929
end
3030

31-
if type_distmx.mutable
31+
if ismutable(type_distmx)
3232
for e in edges(g)
3333
distmx[src(e), dst(e)] += wt_transform[dst(e)] - wt_transform[src(e)]
3434
end
3535
end
3636

3737
return JohnsonState(dists, parents)
3838
end
39-

src/shortestpaths/johnson.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ function johnson_shortest_paths(g::AbstractGraph{U},
2929
type_distmx = typeof(distmx)
3030
#Change when parallel implementation of Bellman Ford available
3131
wt_transform = bellman_ford_shortest_paths(g, vertices(g), distmx).dists
32-
33-
if !type_distmx.mutable && type_distmx != Graphs.DefaultDistance
32+
33+
if !ismutable(type_distmx) && type_distmx != Graphs.DefaultDistance
3434
distmx = sparse(distmx) #Change reference, not value
3535
end
3636

3737
#Weight transform not needed if all weights are positive.
3838
if type_distmx != Graphs.DefaultDistance
3939
for e in edges(g)
40-
distmx[src(e), dst(e)] += wt_transform[src(e)] - wt_transform[dst(e)]
40+
distmx[src(e), dst(e)] += wt_transform[src(e)] - wt_transform[dst(e)]
4141
end
4242
end
4343

@@ -55,7 +55,7 @@ function johnson_shortest_paths(g::AbstractGraph{U},
5555
dists[:, v] .+= wt_transform[v] #Vertical traversal prefered
5656
end
5757

58-
if type_distmx.mutable
58+
if ismutable(type_distmx)
5959
for e in edges(g)
6060
distmx[src(e), dst(e)] += wt_transform[dst(e)] - wt_transform[src(e)]
6161
end

0 commit comments

Comments
 (0)