Reputation: 1029
I know that networkx has a function for creating a tree decomposition:
import networkx as nx
from networkx.algorithms.approximation import treewidth_min_degree
G = createGraph() # an arbitrary function returning a networkx graph
width,decomposition = treewidth_min_degree(G)
Is there a function transforming this tree into a nice tree decomposition.
Edit: A "nice" tree decomposition is a rooted binary tree with four different types of nodes:
I know there is a linear algorithm doing this, but I wonder if this is already implemented somewhere.
Upvotes: 1
Views: 535