Skip to content

Commit 7acd67c

Browse files
committed
Fix is_chordal for GenericGraph vertex types
The GenericGraph type used in the unit tests returns a generator object when neighbors is called on it. Originally, we computed the subsequent_neighbors variable via intersect(neighbors(g, v), numbered), but intersect could not infer the element type of a generator object and fell back to Vector{Any}. This caused a MethodError when passing the result to _induces_clique, so we replaced the intersect call with a filter call.
1 parent 0cc471e commit 7acd67c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/chordality.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function is_chordal end
7070
v = _max_cardinality_vertex(g, unnumbered, numbered)
7171
delete!(unnumbered, v)
7272
push!(numbered, v)
73-
subsequent_neighbors = intersect(neighbors(g, v), numbered)
73+
subsequent_neighbors = filter(in(numbered), collect(neighbors(g, v)))
7474

7575
# A complete subgraph is also called a "clique," hence the naming here
7676
_induces_clique(subsequent_neighbors, g) || return false

0 commit comments

Comments
 (0)