chordal_graph_treewidth#
- chordal_graph_treewidth(G)[source]#
Returns the treewidth of the chordal graph G.
- Parameters:
- Ggraph
A chordal graph.
- Returns:
- treewidthint
The size of the largest clique in the graph minus one.
- Raises:
- NetworkXError
If G is not chordal.
See also
Notes
Self loops are ignored.
References
Examples
>>> G = nx.barbell_graph(4, 6) >>> nx.chordal_graph_treewidth(G) 3