is_perfect

Contents

is_perfect#

graph_tool.structure.is_perfect(g)[git][source]#

Check whether a graph is perfect.

Parameters:
gGraph

Graph to be used. Edge directions are ignored.

Returns:
perfectbool

True if the graph is perfect.

See also

is_chordal

Test for chordal graphs

clique_number

Size of a largest clique

Notes

A graph is perfect if the chromatic number of every induced subgraph equals the size of its largest clique. By the strong perfect graph theorem [chudnovsky-strong-2006], this holds if and only if neither the graph nor its complement has an induced cycle of odd length larger than three. Bipartite and chordal graphs are perfect, and are recognized directly; otherwise, the induced cycles of the graph and of its complement are enumerated as with chordless_cycles(), in parallel from the different starting vertices, until an odd one is found, which takes exponential time in the worst case. (Polynomial algorithms exist [chudnovsky-recognizing-2005], but are impractical.)

References

[chudnovsky-strong-2006]

Maria Chudnovsky, Neil Robertson, Paul Seymour and Robin Thomas, “The strong perfect graph theorem”, Annals of Mathematics 164, 51-229 (2006), DOI: 10.4007/annals.2006.164.51 [sci-hub, @tor]

[chudnovsky-recognizing-2005]

Maria Chudnovsky, Gérard Cornuéjols, Xinming Liu, Paul Seymour and Kristina Vušković, “Recognizing Berge graphs”, Combinatorica 25, 143-186 (2005), DOI: 10.1007/s00493-005-0012-8 [sci-hub, @tor]

Examples

>>> print(gt.is_perfect(gt.circular_graph(5)),
...       gt.is_perfect(gt.circular_graph(6)))
False True