- elimination_order_width(G, order)¶
Calculates the width of the tree decomposition induced by a variable elimination order.
G (NetworkX graph) – The graph on which to compute the width of the tree decomposition.
order (list) – The elimination order. Must be a list of all of the variables in G.
treewidth – The width of the tree decomposition induced by order.
- Return type
This example computes the width of the tree decomposition for the \(K_4\) complete graph induced by an elimination order found through the min-width heuristic.
>>> K_4 = nx.complete_graph(4) >>> tw, order = dnx.min_width_heuristic(K_4) >>> print(tw) 3 >>> dnx.elimination_order_width(K_4, order) 3