Skip to content

Commit 1b309f6

Browse files
committed
Fix name collision in maximum_clique
Graphs v1.14.0 started exporting `maximum_clique`, which is a function that MolecularGraph also exports. The two names collide, which causes problems for MolecularGraph's test suite. This "fixes" the problem by merging the two functions, having MolecularGraph add new methods to the Graphs function. Currently, this PR should be viewed as a "trial balloon" because there is a major problem: solving the problem this way is piracy. There are several alternatives, including (1) renaming MolecularGraph's function to something else, (2) scoping calls to `MolecularGraph.maximum_clique` in the test suite, or (3) defining a new function in MolecularGraph that calls Graphs' function and then does some post-processing. Let me know your preferred solution and I can implement it. Because this was introducing piracy, I also took the liberty of adding Aqua tests. Currently this highlights quite a few failures (not just the piracy I introduced), so I marked the test as broken. Fixing these should be the subject of a future PR.
1 parent 5e015a8 commit 1b309f6

3 files changed

Lines changed: 26 additions & 8 deletions

File tree

Project.toml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
name = "MolecularGraph"
22
uuid = "6c89ec66-9cd8-5372-9f91-fabc50dd27fd"
33
authors = ["Seiji Matsuoka <ms0ae8ti1sj2ui@gmail.com"]
4-
version = "0.22.0"
4+
version = "0.22.1"
55

66
[deps]
77
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
88
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
99
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
10+
EzXML = "8f5d6c58-4d21-5cfd-889c-e3ad7ee6a615"
1011
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
1112
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
1213
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
13-
EzXML = "8f5d6c58-4d21-5cfd-889c-e3ad7ee6a615"
1414
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1515
MakieCore = "20f20a25-4f0e-4fdf-b5d1-57303727442b"
1616
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
@@ -30,13 +30,14 @@ CairoExt = "Cairo"
3030
RDKitExt = "RDKitMinimalLib"
3131

3232
[compat]
33+
Aqua = "0.8"
3334
Cairo = "1.1"
3435
Colors = "0.13"
3536
DelimitedFiles = "1"
37+
EzXML = "1"
3638
GeometryBasics = "0.5"
3739
Graphs = "1.12"
3840
JSON = "1"
39-
EzXML = "1"
4041
MakieCore = "0.9,0.10"
4142
OrderedCollections = "1.8"
4243
RDKitMinimalLib = "1.2"
@@ -49,8 +50,9 @@ julia = "1.9"
4950
libinchi_jll = "1.5"
5051

5152
[extras]
53+
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
5254
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
5355
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
5456

5557
[targets]
56-
test = ["Test", "Logging"]
58+
test = ["Test", "Aqua", "Logging"]

src/graph/clique.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,16 @@ all_maximal_cliques(g::SimpleGraph{T}; kwargs...
138138
139139
Calculate maximum clique.
140140
"""
141-
function maximum_clique(::Type{U}, g::SimpleGraph{T}; kwargs...) where {T,U}
142-
state = MaxCliqueState{T,U}(g; kwargs...)
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
143143
expand!(state, Set(vertices(g)), Set(vertices(g)))
144144
if state.status == :ongoing
145145
state.status = :done
146146
end
147147
return state.maxsofar, state.status
148148
end
149-
maximum_clique(g::SimpleGraph{T}; kwargs...
150-
) where T = maximum_clique(Vector{T}, g; kwargs...)
149+
Graphs.maximum_clique(g::SimpleGraph{T}; kwargs...
150+
) where T = maximum_clique(Vector{T}, g; kwargs...) # FIXME: this is piracy
151151

152152

153153

test/runtests.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,19 @@ include("./draw/svg.jl")
107107
include("./draw/3d.jl")
108108

109109
end
110+
111+
using MolecularGraph
112+
using Aqua
113+
using Test
114+
115+
@testset "Aqua" begin
116+
# Aqua.test_ambiguities(MolecularGraph) # broken
117+
# Aqua.test_unbound_args(MolecularGraph) # broken
118+
# Aqua.test_undefined_exports(MolecularGraph) # broken
119+
Aqua.test_project_extras(MolecularGraph)
120+
Aqua.test_stale_deps(MolecularGraph)
121+
# Aqua.test_deps_compat(MolecularGraph) # broken
122+
# Aqua.test_piracies(MolecularGraph) # broken
123+
Aqua.test_persistent_tasks(MolecularGraph)
124+
Aqua.test_undocumented_names(MolecularGraph)
125+
end

0 commit comments

Comments
 (0)