chordal_cliques#
- graph_tool.structure.chordal_cliques(g)[git][source]#
Return the maximal cliques of a chordal graph.
- Parameters:
- g
Graph Chordal graph to be used. Edge directions are ignored.
- g
- Returns:
- cliques
listofnumpy.ndarray The vertices of every maximal clique.
- cliques
See also
is_chordalTest for chordal graphs
maximal_cliquesMaximal cliques of a general graph
junction_treeTree of the maximal cliques of a chordal completion
Notes
A chordal graph has at most \(V\) maximal cliques, which are found from the order of maximum cardinality search [blair-introduction-1993] in time \(O(V + E)\). The treewidth of a chordal graph is the size of its largest clique minus one. A
ValueErroris raised if the graph is not chordal (seeis_chordal()); the maximal cliques of general graphs are given bymaximal_cliques().References
[blair-introduction-1993]Jean R. S. Blair and Barry Peyton, “An introduction to chordal graphs and clique trees”, in Graph Theory and Sparse Matrix Computation, Springer, 1-29 (1993), DOI: 10.1007/978-1-4613-8369-7_1 [sci-hub, @tor]
Examples
>>> g = gt.circular_graph(6) >>> g.add_edge_list(gt.chordal_completion(g)) >>> cs = gt.chordal_cliques(g) >>> print(len(cs), max([len(c) for c in cs]) - 1) 4 2