Skip to content

Commit 826b8fe

Browse files
Add more Julia versions to ci/cd workflow (#87)
* Add more Julia versions to ci/cd workflow * Ensure functions work on Julia v1.3 Co-authored-by: Hans Würfel <[email protected]>
1 parent c2e4170 commit 826b8fe

File tree

7 files changed

+23
-7
lines changed

7 files changed

+23
-7
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
version:
20+
- 'nightly'
2021
- '1'
22+
- '1.6'
23+
- '1.3'
2124
os:
2225
- ubuntu-latest
2326
- macos-latest

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ version = "1.5.0"
44

55
[deps]
66
ArnoldiMethod = "ec485272-7323-5ecc-a04f-4719b315124d"
7+
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
78
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
89
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
910
Inflate = "d25df0c9-e2be-5dd7-82c8-3ad0b3e990b9"
@@ -16,6 +17,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1617

1718
[compat]
1819
ArnoldiMethod = "0.1, 0.2"
20+
Compat = "3.40"
1921
DataStructures = "0.17, 0.18"
2022
Inflate = "0.1"
2123
SimpleTraits = "0.9"

src/Experimental/ShortestPaths/johnson.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2+
# Currently used to support the ismutable function that is not available in Julia < v1.7
3+
using Compat
4+
15
"""
26
struct Johnson <: ShortestPathAlgorithm
37
@@ -26,7 +30,7 @@ function shortest_paths(g::AbstractGraph{U}, distmx::AbstractMatrix{T}, ::Johnso
2630
#Change when parallel implementation of Bellman Ford available
2731
wt_transform = Graphs.Experimental.ShortestPaths.dists(shortest_paths(g, vertices(g), distmx, BellmanFord()))
2832

29-
if !ismutable(distmx) && type_distmx != Graphs.DefaultDistance
33+
@compat if !ismutable(distmx) && type_distmx != Graphs.DefaultDistance
3034
distmx = sparse(distmx) #Change reference, not value
3135
end
3236

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

54-
if ismutable(distmx)
58+
@compat if ismutable(distmx)
5559
for e in edges(g)
5660
distmx[src(e), dst(e)] += wt_transform[dst(e)] - wt_transform[src(e)]
5761
end

src/Graphs.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ using SimpleTraits
66
using ArnoldiMethod
77
using Statistics: mean
88

9+
# Currently used to support the ismutable function that is not available in Julia < v1.7
10+
using Compat
11+
912
using Inflate: InflateGzipStream
1013
using DataStructures: IntDisjointSets, PriorityQueue, dequeue!, dequeue_pair!, enqueue!, heappop!, heappush!, in_same_set, peek, union!, find_root!
1114
using LinearAlgebra: I, Symmetric, diagm, eigen, eigvals, norm, rmul!, tril, triu

src/Parallel/shortestpaths/johnson.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2+
# Currently used to support the ismutable function that is not available in Julia < v1.7
3+
using Compat
4+
15
function johnson_shortest_paths(g::AbstractGraph{U},
26
distmx::AbstractMatrix{T}=weights(g)) where T <: Real where U <: Integer
37

@@ -6,7 +10,7 @@ distmx::AbstractMatrix{T}=weights(g)) where T <: Real where U <: Integer
610
#Change when parallel implementation of Bellman Ford available
711
wt_transform = bellman_ford_shortest_paths(g, vertices(g), distmx).dists
812

9-
if !ismutable(distmx) && type_distmx != Graphs.DefaultDistance
13+
@compat if !ismutable(distmx) && type_distmx != Graphs.DefaultDistance
1014
distmx = sparse(distmx) #Change reference, not value
1115
end
1216

@@ -28,7 +32,7 @@ distmx::AbstractMatrix{T}=weights(g)) where T <: Real where U <: Integer
2832
dists[:, v] .+= wt_transform[v] #Vertical traversal prefered
2933
end
3034

31-
if ismutable(distmx)
35+
@compat if ismutable(distmx)
3236
for e in edges(g)
3337
distmx[src(e), dst(e)] += wt_transform[dst(e)] - wt_transform[src(e)]
3438
end

src/operators.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ function merge_vertices!(g::Graph{T}, vs::Vector{U} where U <: Integer) where T
844844

845845

846846
# Drop excess vertices
847-
g.fadjlist = g.fadjlist[begin:(end - length(vs)+1)]
847+
g.fadjlist = g.fadjlist[firstindex(g.fadjlist):(end - length(vs)+1)]
848848

849849
# Correct edge counts
850850
g.ne = sum(degree(g, i) for i in vertices(g)) / 2

src/shortestpaths/johnson.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function johnson_shortest_paths(g::AbstractGraph{U},
3030
#Change when parallel implementation of Bellman Ford available
3131
wt_transform = bellman_ford_shortest_paths(g, vertices(g), distmx).dists
3232

33-
if !ismutable(distmx) && type_distmx != Graphs.DefaultDistance
33+
@compat if !ismutable(distmx) && type_distmx != Graphs.DefaultDistance
3434
distmx = sparse(distmx) #Change reference, not value
3535
end
3636

@@ -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 ismutable(distmx)
58+
@compat if ismutable(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)