@@ -14217,20 +14217,18 @@ def is_chordal(self, certificate=False, algorithm="B"):
14217
14217
a hole.
14218
14218
14219
14219
- ``algorithm`` -- string (default: ``"B"``); the algorithm to choose
14220
- among ``"A"`` or ``"B"`` (see next section) . While they will agree on
14221
- whether the given graph is chordal, they cannot be expected to return
14222
- the same certificates.
14220
+ among ``"A"`` or ``"B"``. While they will agree on whether the given
14221
+ graph is chordal, they cannot be expected to return the same
14222
+ certificates.
14223
14223
14224
14224
ALGORITHM:
14225
14225
14226
- This algorithm works through computing a Lex BFS on the graph, then
14227
- checking whether the order is a Perfect Elimination Order by computing
14228
- for each vertex `v` the subgraph induces by its non-deleted neighbors,
14229
- then testing whether this graph is complete.
14230
-
14231
- This problem can be solved in `O(m)` [RT1975]_ ( where `m` is the number
14232
- of edges in the graph ) but this implementation is not linear because of
14233
- the complexity of Lex BFS.
14226
+ This method implements the algorithm proposed in [RT1975]_ for the
14227
+ recognition of chordal graphs with time complexity in `O(m)`. The
14228
+ algorithm works through computing a Lex BFS on the graph, then checking
14229
+ whether the order is a Perfect Elimination Order by computing for each
14230
+ vertex `v` the subgraph induced by its non-deleted neighbors, then
14231
+ testing whether this graph is complete.
14234
14232
14235
14233
EXAMPLES:
14236
14234
@@ -14344,7 +14342,7 @@ def is_chordal(self, certificate=False, algorithm="B"):
14344
14342
continue
14345
14343
14346
14344
x = next(t_peo.neighbor_out_iterator(v))
14347
- S = self.neighbors(x) + [x]
14345
+ S = self.neighbors(x, closed=True)
14348
14346
14349
14347
if not frozenset(g.neighbor_iterator(v)).issubset(S):
14350
14348
@@ -14380,7 +14378,7 @@ def is_chordal(self, certificate=False, algorithm="B"):
14380
14378
peo, t_peo = self.lex_BFS(reverse=True, tree=True)
14381
14379
14382
14380
# Remembering the (closed) neighborhoods of each vertex
14383
- neighbors_subsets = {v: frozenset(self.neighbors(v) + [v] ) for v in g}
14381
+ neighbors_subsets = {v: frozenset(self.neighbor_iterator(v, closed=True) ) for v in g}
14384
14382
pos_in_peo = dict(zip(peo, range(self.order())))
14385
14383
14386
14384
# Iteratively removing vertices and checking everything is fine.
0 commit comments