is_perfect#
- graph_tool.structure.is_perfect(g)[git][source]#
Check whether a graph is perfect.
- Parameters:
- g
Graph Graph to be used. Edge directions are ignored.
- g
- Returns:
- perfect
bool Trueif the graph is perfect.
- perfect
See also
is_chordalTest for chordal graphs
clique_numberSize 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