Skip to content

Commit 6818196

Browse files
committed
Fixes for different Julia versions
1 parent 1b309f6 commit 6818196

4 files changed

Lines changed: 46 additions & 20 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.DS_Store
22
Manifest.toml
3+
Manifest-v*.toml
34

45
_temp

Project.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ Test = "1"
4747
YAML = "0.4"
4848
coordgenlibs_jll = "3.0.2"
4949
julia = "1.9"
50+
Dates = "1"
51+
LinearAlgebra = "1"
52+
Printf = "1"
53+
Logging = "1"
5054
libinchi_jll = "1.5"
5155

5256
[extras]

src/graph/clique.jl

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -133,22 +133,39 @@ all_maximal_cliques(g::SimpleGraph{T}; kwargs...
133133
) where T = all_maximal_cliques(Vector{T}, g; kwargs...)
134134

135135

136-
"""
137-
maximum_clique(::Type{U}, g::SimpleGraph{T}; kwargs...) where {T,U} -> (U, Symbol)
138-
139-
Calculate maximum clique.
140-
"""
141-
function Graphs.maximum_clique(::Type{U}, g::SimpleGraph{T}; kwargs...) where {T,U}
142-
state = MaxCliqueState{T,U}(g; kwargs...) # FIXME: this is piracy
143-
expand!(state, Set(vertices(g)), Set(vertices(g)))
144-
if state.status == :ongoing
145-
state.status = :done
136+
if @isdefined(maximum_clique) # Graphs 1.14+ defines maximum_clique
137+
"""
138+
maximum_clique(::Type{U}, g::SimpleGraph{T}; kwargs...) where {T,U} -> (U, Symbol)
139+
140+
Calculate maximum clique.
141+
"""
142+
function Graphs.maximum_clique(::Type{U}, g::SimpleGraph{T}; kwargs...) where {T,U}
143+
state = MaxCliqueState{T,U}(g; kwargs...) # FIXME: this is piracy
144+
expand!(state, Set(vertices(g)), Set(vertices(g)))
145+
if state.status == :ongoing
146+
state.status = :done
147+
end
148+
return state.maxsofar, state.status
146149
end
147-
return state.maxsofar, state.status
150+
Graphs.maximum_clique(g::SimpleGraph{T}; kwargs...
151+
) where T = maximum_clique(Vector{T}, g; kwargs...) # FIXME: this is piracy
152+
else # Julia 1.9 cannot install Graphs 1.14+
153+
"""
154+
maximum_clique(::Type{U}, g::SimpleGraph{T}; kwargs...) where {T,U} -> (U, Symbol)
155+
156+
Calculate maximum clique.
157+
"""
158+
function maximum_clique(::Type{U}, g::SimpleGraph{T}; kwargs...) where {T,U}
159+
state = MaxCliqueState{T,U}(g; kwargs...)
160+
expand!(state, Set(vertices(g)), Set(vertices(g)))
161+
if state.status == :ongoing
162+
state.status = :done
163+
end
164+
return state.maxsofar, state.status
165+
end
166+
maximum_clique(g::SimpleGraph{T}; kwargs...
167+
) where T = maximum_clique(Vector{T}, g; kwargs...)
148168
end
149-
Graphs.maximum_clique(g::SimpleGraph{T}; kwargs...
150-
) where T = maximum_clique(Vector{T}, g; kwargs...) # FIXME: this is piracy
151-
152169

153170

154171
# Connected cliques (c-cliques)

test/runtests.jl

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,17 @@ using Aqua
113113
using Test
114114

115115
@testset "Aqua" begin
116-
# Aqua.test_ambiguities(MolecularGraph) # broken
117-
# Aqua.test_unbound_args(MolecularGraph) # broken
118-
# Aqua.test_undefined_exports(MolecularGraph) # broken
116+
Aqua.test_ambiguities(MolecularGraph; broken=true)
117+
Aqua.test_unbound_args(MolecularGraph; broken=true)
118+
Aqua.test_undefined_exports(MolecularGraph; broken=true)
119119
Aqua.test_project_extras(MolecularGraph)
120120
Aqua.test_stale_deps(MolecularGraph)
121-
# Aqua.test_deps_compat(MolecularGraph) # broken
122-
# Aqua.test_piracies(MolecularGraph) # broken
121+
Aqua.test_deps_compat(MolecularGraph)
122+
if Base.VERSION < v"1.10"
123+
Aqua.test_piracies(MolecularGraph)
124+
else
125+
Aqua.test_piracies(MolecularGraph; broken=true)
126+
end
123127
Aqua.test_persistent_tasks(MolecularGraph)
124-
Aqua.test_undocumented_names(MolecularGraph)
128+
Aqua.test_undocumented_names(MolecularGraph; broken=true)
125129
end

0 commit comments

Comments
 (0)