@@ -87,9 +87,7 @@ function has_induced_subgraphisomorph(
8787 vertex_relation:: Union{Nothing,Function} = nothing ,
8888 edge_relation:: Union{Nothing,Function} = nothing ,
8989):: Bool
90- return has_induced_subgraphisomorph (
91- g1, g2, alg; vertex_relation= vertex_relation, edge_relation= edge_relation
92- )
90+ throw (MethodError (has_induced_subgraphisomorph, (g1, g2, alg)))
9391end
9492
9593"""
@@ -130,9 +128,7 @@ function has_subgraphisomorph(
130128 vertex_relation:: Union{Nothing,Function} = nothing ,
131129 edge_relation:: Union{Nothing,Function} = nothing ,
132130):: Bool
133- return has_subgraphisomorph (
134- g1, g2, alg; vertex_relation= vertex_relation, edge_relation= edge_relation
135- )
131+ throw (MethodError (has_subgraphisomorph, (g1, g2, alg)))
136132end
137133
138134"""
@@ -141,12 +137,14 @@ end
141137Return `true` if the graph `g1` is isomorphic to `g2`.
142138
143139### Optional Arguments
144- - `alg`: The algorithm that is used to find the induced subgraph isomorphism. Can be only
145- `VF2()` at the moment .
140+ - `alg`: The algorithm that is used to find the induced subgraph isomorphism. Can be
141+ `VF2()` or `AlgNautyGraphs()`, if `NautyGraphs` is installed and imported .
146142- `vertex_relation`: A binary function that takes a vertex from `g1` and one from `g2`. An
147- isomorphism only exists if this function returns `true` for all matched vertices.
143+ isomorphism only exists if this function returns `true` for all matched vertices. Only
144+ works with `VF2()` at the moment.
148145- `edge_relation`: A binary function that takes an edge from `g1` and one from `g2`. An
149- isomorphism only exists if this function returns `true` for all matched edges.
146+ isomorphism only exists if this function returns `true` for all matched edges. Only
147+ works with `VF2()` at the moment.
150148
151149### Examples
152150```doctest.jl
@@ -173,9 +171,40 @@ function has_isomorph(
173171 vertex_relation:: Union{Nothing,Function} = nothing ,
174172 edge_relation:: Union{Nothing,Function} = nothing ,
175173):: Bool
176- return has_isomorph (
177- g1, g2, alg; vertex_relation= vertex_relation, edge_relation= edge_relation
178- )
174+ throw (MethodError (has_isomorph, (g1, g2, alg)))
175+ end
176+
177+ """
178+ canonize!(g, alg::IsomorphismAlgorithm=AlgNautyGraphs())
179+
180+ Permute the vertices of graph `g` into the canonical order defined by the algorithm `alg` and return the permutation.
181+ If graphs `g1` and `g2` are isomorphic, the orders of their vertices will be equal after canonizing them with the same algorithm.
182+
183+ ### Optional Arguments
184+ - `alg`: The algorithm that is used to canonize the graph. Can be only be `AlgNautyGraphs()`
185+ at this moment, which requires `NautyGraphs` to be installed and imported.
186+
187+ ### Examples
188+ ```doctest.jl
189+ julia> canonize!(path_graph(3))
190+ [1, 3, 2]
191+
192+ julia> g1 = path_digraph(4)
193+ julia> g2 = path_digraph(4)[[2, 3, 1, 4]]
194+ julia> g1 == g2
195+ false
196+ julia> canonize!(g1)
197+ [4, 2, 3, 1]
198+ julia> canonize!(g2)
199+ [4, 1, 2, 3]
200+ julia> g1 == g2
201+ true
202+ ```
203+ ### See also
204+ [`has_isomorph`](@ref)
205+ """
206+ function canonize! (g:: AbstractGraph , alg:: IsomorphismAlgorithm = AlgNautyGraphs ())
207+ throw (MethodError (canonize!, (g, alg)))
179208end
180209
181210"""
@@ -214,9 +243,7 @@ function count_induced_subgraphisomorph(
214243 vertex_relation:: Union{Nothing,Function} = nothing ,
215244 edge_relation:: Union{Nothing,Function} = nothing ,
216245):: Int
217- return count_induced_subgraphisomorph (
218- g1, g2, alg; vertex_relation= vertex_relation, edge_relation= edge_relation
219- )
246+ throw (MethodError (count_induced_subgraphisomorph, (g1, g2, alg)))
220247end
221248
222249"""
@@ -257,13 +284,7 @@ function count_subgraphisomorph(
257284 vertex_relation:: Union{Nothing,Function} = nothing ,
258285 edge_relation:: Union{Nothing,Function} = nothing ,
259286):: Int
260- return count_subgraphisomorph (
261- g1:: AbstractGraph ,
262- g2:: AbstractGraph ,
263- VF2 ();
264- vertex_relation= vertex_relation,
265- edge_relation= edge_relation,
266- )
287+ throw (MethodError (count_subgraphisomorph, (g1, g2, alg)))
267288end
268289
269290"""
@@ -304,9 +325,7 @@ function count_isomorph(
304325 vertex_relation:: Union{Nothing,Function} = nothing ,
305326 edge_relation:: Union{Nothing,Function} = nothing ,
306327):: Int
307- return count_isomorph (
308- g1, g2, alg; vertex_relation= vertex_relation, edge_relation= edge_relation
309- )
328+ throw (MethodError (count_isomorph, (g1, g2, alg)))
310329end
311330
312331"""
@@ -353,9 +372,7 @@ function all_induced_subgraphisomorph(
353372 vertex_relation:: Union{Nothing,Function} = nothing ,
354373 edge_relation:: Union{Nothing,Function} = nothing ,
355374):: Channel{Vector{Tuple{eltype(g1),eltype(g2)}}}
356- return all_induced_subgraphisomorph (
357- g1, g2, alg; vertex_relation= vertex_relation, edge_relation= edge_relation
358- )
375+ throw (MethodError (all_induced_subgraphisomorph, (g1, g2, alg)))
359376end
360377
361378"""
@@ -404,9 +421,7 @@ function all_subgraphisomorph(
404421 vertex_relation:: Union{Nothing,Function} = nothing ,
405422 edge_relation:: Union{Nothing,Function} = nothing ,
406423):: Channel{Vector{Tuple{eltype(g1),eltype(g2)}}}
407- return all_subgraphisomorph (
408- g1, g2, alg; vertex_relation= vertex_relation, edge_relation= edge_relation
409- )
424+ throw (MethodError (all_subgraphisomorph, (g1, g2, alg)))
410425end
411426
412427"""
@@ -458,7 +473,5 @@ function all_isomorph(
458473 vertex_relation:: Union{Nothing,Function} = nothing ,
459474 edge_relation:: Union{Nothing,Function} = nothing ,
460475):: Channel{Vector{Tuple{eltype(g1),eltype(g2)}}}
461- return all_isomorph (
462- g1, g2, alg; vertex_relation= vertex_relation, edge_relation= edge_relation
463- )
476+ throw (MethodError (all_isomorph, (g1, g2, alg)))
464477end
0 commit comments