Skip to content

Commit 6c2fa92

Browse files
committed
Fix input type for is_chordal
Originally, we restricted the input type for is_chordal to AbstractSimpleGraph to rule out parallel edges, but some other graph types we would like to support (such as SimpleWeightedGraph) are of the more general AbstractGraph type. It turns out the current AbstractGraph interface aleady does not support parallel edges, so there is no worry here--it is already stated in the Implementation Notes anyway that is_chordal should not take in graphs with parallel edges as input.
1 parent 32cc562 commit 6c2fa92

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/chordality.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ parallel edges.
3434
# Examples
3535
TODO: Add examples
3636
"""
37-
function is_chordal(g::AbstractSimpleGraph)
38-
# The possibility of self-loops is already ruled out by the `AbstractSimpleGraph` type
37+
function is_chordal(g::AbstractGraph)
38+
# The `AbstractGraph` interface does not support parallel edges, so no need to check
3939
is_directed(g) && throw(ArgumentError("Graph must be undirected"))
4040
has_self_loops(g) && throw(ArgumentError("Graph must not have self-loops"))
4141

@@ -69,10 +69,10 @@ function is_chordal(g::AbstractSimpleGraph)
6969
end
7070

7171
function _max_cardinality_node(
72-
g::AbstractSimpleGraph, unnumbered::Set{T}, numbered::Set{T}
72+
g::AbstractGraph, unnumbered::Set{T}, numbered::Set{T}
7373
) where {T}
7474
cardinality(v::T) = count(in(numbered), neighbors(g, v))
7575
return argmax(cardinality, unnumbered)
7676
end
7777

78-
_is_complete_graph(g::AbstractSimpleGraph) = density(g) == 1
78+
_is_complete_graph(g::AbstractGraph) = density(g) == 1

0 commit comments

Comments
 (0)