is_chordal#
- graph_tool.structure.is_chordal(g)[git][source]#
Check whether a graph is chordal.
- Parameters:
- g
Graph Graph to be used. Edge directions are ignored.
- g
- Returns:
- chordal
bool Trueif the graph is chordal.
- chordal
See also
chordal_completionMinimal chordal completion
chordal_cliquesMaximal cliques of a chordal graph
chordless_cyclesAll chordless cycles
is_perfectTest for perfect graphs
Notes
A graph is chordal if every cycle of four or more vertices has a chord, i.e. an edge between two of its vertices that are not consecutive in the cycle. Equivalently, it has a perfect elimination ordering, in which the neighbors of every vertex that come after it form a clique. Such an ordering is the reverse of the order of maximum cardinality search, which visits each time the vertex with the most visited neighbors, and it is checked with the zero fill-in test of Tarjan and Yannakakis [tarjan-simple-1984], in time \(O(V + E)\).
References
[tarjan-simple-1984]Robert E. Tarjan and Mihalis Yannakakis, “Simple linear-time algorithms to test chordality of graphs, test acyclicity of hypergraphs, and selectively reduce acyclic hypergraphs”, SIAM Journal on Computing 13, 566-579 (1984), DOI: 10.1137/0213035 [sci-hub, @tor]
Examples
>>> g = gt.lattice([3, 3]) >>> print(gt.is_chordal(g)) False >>> g.add_edge_list(gt.chordal_completion(g)) >>> print(gt.is_chordal(g)) True