A Constraint Model for the Tree Decomposition of a Graph
Benjamin Bumpus, Patrick Prosser, James Trimble

TL;DR
This paper introduces a constraint-based approach for generating tree decompositions of graphs, enabling the determination of tree width and providing explicit decompositions as proof.
Contribution
It presents a novel constraint model that simultaneously computes the tree width and constructs a corresponding tree decomposition.
Findings
Successfully computes tree width for various graphs
Provides explicit tree decompositions as witnesses
Demonstrates effectiveness of constraint programming in graph decomposition
Abstract
We present a constraint model for the problem of producing a tree decomposition of a graph. The inputs to the model are a simple graph G, the number of nodes in the desired tree decomposition and the maximum cardinality of each node in that decomposition. Via a sequence of decision problems, the model allows us to find the tree width of a graph whilst delivering a tree decomposition of that width, i.e. a witness.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsAdvanced Graph Theory Research · Constraint Satisfaction and Optimization · Graph Theory and Algorithms
11institutetext: School of Computing Science, University of Glasgow, Scotland
11email: [email protected]
https://www.gla.ac.uk/schools/computing/
A Constraint Model for the Tree Decomposition of a Graph
Benjamin Bumpus 11 0000-0002-8686-2319
Patrick Prosser 11 0000-0003-4460-6912
James Trimble 11 0000-0001-7282-8745
Abstract
We present a constraint model for the problem of producing a tree decomposition of a graph. The inputs to the model are a simple graph G, the number of nodes in the desired tree decomposition and the maximum cardinality of each node in that decomposition. Via a sequence of decision problems, the model allows us to find the tree width of a graph whilst delivering a tree decomposition of that width, i.e. a witness.
Keywords:
Tree Decomposition Tree Width Constraint Programming Model.
1 Introduction
A tree decomposition of a graph is a mapping from vertices in a graph to nodes in a tree, where the tree nodes are subsets of the vertices of the graph. The purpose of this is to produce a tree-like strucure of the graph so that, whatever problem that graph is representing, it can be solved node by node, with a complexity bounded by some function of the size of the nodes. Therefore it is a way of decomposing a problem. Finding a tree decomposition with minimum width has been the Holy Grail of the fixed parameter tractability research community [2, 3, 4] and has a long history in Constraint Programming, most notably due to Rina Dechter [6, 5, 7], and more recently by Abseher et al [1].
Our goal is to present what we believe to be the first Constraint Programming (CP) model for this problem. Our model takes as input a simple graph G and outputs a tree decomposition of that graph, T, with a specified width () and a specified number of nodes (). If no such tree exists it returns false. In the next section we present the definition of tree decomposition and treewidth. We then present our CP model, show it running and conclude.
2 Tree Decomposition and Treewidth: a definition
Given a simple graph G = (V,E) it may be decomposed into a tree T, where the tree is composed of nodes, such that:
A node is an improper subset of the vertices of V. 2. 2.
The union of all the nodes in the tree is the set of vertices V. 3. 3.
If edge (u,v) is in E then that pair of vertices will exist together in at least one of the nodes of T. 4. 4.
If vertex v is in node and the same vertex is in node then vertex v must exist in all nodes in the path from to . This can also be expressed as: for any three nodes , and , if lies on the path from to then A third interpretation of this property is that for any vertex in V, the set of nodes that contain induces a single subtree of T.
Property (4) is sometimes refered to as the running intersection property. Conventionally, nodes of T are said to contain bags where a bag is a set of vertices. To avoid confusion, due to a bag being a synonym for a multi-set, we will say that a node is a set of vertices.
The width of a tree decompostion is the size of the largest node in that decomposition. The treewidth tw(G) is then the minimum width among all possible tree decompositions of G. Conventionally, treewidth is the minimum width minus one. This is because a tree decomposition of a graph G that is itself a tree will have nodes in its tree decomposition T, where each node of T contains a single edge in G, and convention dictates that its treewidth shall be deemed to be one.
3 The Constraint Model
We assume that we are given a simple graph G with vertex set V and edge set E. There are vertices in V and the tree decomposition has exactly nodes, and each node has cardinality no greater than . We start by giving the constrained variables of the model, then we give the constraints.
3.1 The Variables
[TABLE]
Constrained set variable ((1) above) is a node in the tree decomposition of G, where we are allowed tree nodes and each node is an improper subset of the vertices V (numbered 0 to ).
The tree decomposition is a rooted tree, where constrained integer variable ((2) above) points to the parent of , and node is at in the tree (constrained integer variable (3) above). Note that there is no requirement that the tree decomposition be a rooted tree, but making this assumption simplifies our model without loss of generality.
Property (3) insists that each edge appears in at least one node. The constrained integer variable ((4) above) is equal to one if and only if edge (u,v) is contained in node . The variable only exists if edge (u,v) exists in E.
We need to maintain the intersections between all pairs of nodes, in order to realise the running intersection property, consequently constrained set variable ((4) above) is .
3.2 The Constraints
Our first constraint, constraint 6, resticts the width of the tree decomposition, such that all nodes have cardinality of at most .
[TABLE]
Constraint 7 ensure that property (2) is respected, i.e. that all vertices in V appear in T.
[TABLE]
We now capture the intersections between all pairs of nodes, in constraint 8. Note that this is a sparse array, where the constrained set variable is copied into array element .
[TABLE]
Constraints 9 to 12 maintain the rooted tree property. Constraints 9 and 10 state that node is the root of the tree and is at depth zero. Constraint 11 states that all other nodes, to , cannot have themselves as parents. Constraint 12 states that if node is the parent of then the depth of is one more than the depth of its parent . Constraints 9 to 12 suffice to ensure that we have a rooted tree.
[TABLE]
Constraints 13 to 15 ensure that property (3) holds, i.e. that every edge is contained in at least one node of the tree. Constraint 13 allows us to use only the top half of the matrix; because edges are undirected is exactly the same variable as . Constraint 14 states that takes the value one if and only if the edge (u,v) is contained in the node of the tree, and constraint 15 insists that the edge (u,v) exists in at least one node.
[TABLE]
Finally we have constraint 16, to enforce the running intersection property (4). If we have two distinct nodes and that are at the same depth, or node is deeper in the tree than , then if we relax the property that the tree is rooted, then the parent of is on the path from to , and we insist that every vertex that is common to and , i.e. is subsumed by the vertices in the parent node of , namely .
[TABLE]
4 Implementation
We have endeavoured to use only constraints that we should expect to see in any Constraint Programming toolkit. This is one of the reasons why we did not use the tree constraint (such as [8]). In implementing our model, constraint 16 required the use of the element constraint, where a constrained integer variable is used as an index into an array of constrained set variables. This is the most sophisticated constraint in our model.
The model was implemented in the choco4 CP toolkit [9]. The decision variables were the variables combined with the flattened variables. This was a convenience so that we could use library variable and value ordering heuristics, rather than have something more complex that allowed us to mix constrained integer variables with constrained set variables.
Simple symmetry breaking was added. The nodes were channelled to bits sets, such that bit set . A lexicographical ordering was then posted between bit sets such that .
5 Computational Experience
Finding the tree width of a graph is done as a sequence of decision problems. We can start with the number of nodes in the tree to be equal to 1, and the width . A single node tree is then found trivially. We then increment and decrement and repeat the process until (in which case G is a tree) or failure is reported, and the previous values of and give us an optimal tree decomposition of minimum width . This process is sound and complete:
Proof
Proposition: If is a tree decomposition of nodes and width of graph , with no duplicate nodes, then , where is the number of vertices in . By way of contradiction, suppose otherwise, then all tree decompositions of would require a tree with more than nodes. But since we do not allow duplicate nodes, every node must contain one “unseen” vertex, hence , and that is a contradiction.
In Figure 1 we show the results of this process on a graph with 8 vertices and 13 edges. We show the tree decompositions for and , and onwards to the optimal decomposition and . For and our model required 2.4 seconds of resolution time and 7,388 decisions. For and our model required 1.2 seconds of resolution time and 2,959 decisions. Optimality, the unsatisfiability of and , is proved in 0.2 seconds and 197 decisions.
We do not include detailed experimental comparisons with existing algorithms, but we observe that our model is orders of magnitude slower than state-of-the-art methods for tree decomposition. Rather than being of practical use as a solver, we present our model as a way of exploring and explaining tree width to an interested user, and as a tool that could easily be extended to handle side constraints. It might be likened to an easily assembled and easily adapted Tinkertoy.
6 Conclusion
We present what we believe to be the first CP model for tree decomposition of a graph, with a process that allows us to determine the tree width of a graph. The model is simple, and we believe it can be readily encoded in most any CP modelling languages. Our model, in its current form, is too slow to be of pratical use, but it might have a place as a dynamic tool to help those who “want to get to know about tree width.” Our model is also adaptable. For example, we can find the path width of a graph via a simple edit: .
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[1] M. Abseher, N. Musliu, and S. Woltran. htd - A free, open-source framework for (customized) tree decompositions and beyond. In Integration of AI and OR Techniques in Constraint Programming - 14th International Conference, CPAIOR 2017, Padua, Italy, June 5-8, 2017, Proceedings , pages 376–386, 2017.
- 2[2] H. L. Bodlaender. A tourist guide through treewidth. Acta Cybern. , 11(1-2):1–21, 1993.
- 3[3] H. L. Bodlaender. A linear-time algorithm for finding tree-decompositions of small treewidth. SIAM J. Comput. , 25(6):1305–1317, 1996.
- 4[4] H. L. Bodlaender, F. V. Fomin, A. M. C. A. Koster, D. Kratsch, and D. M. Thilikos. On exact algorithms for treewidth. ACM Trans. Algorithms , 9(1):12:1–12:23, 2012.
- 5[5] R. Dechter. Enhancement schemes for constraint processing: Backjumping, learning, and cutset decomposition. Artif. Intell. , 41(3):273–312, 1990.
- 6[6] R. Dechter and J. Pearl. Tree clustering for constraint networks. Artif. Intell. , 38(3):353–366, 1989.
- 7[7] V. Gogate and R. Dechter. A complete anytime algorithm for treewidth. In UAI ’04, Proceedings of the 20th Conference in Uncertainty in Artificial Intelligence, Banff, Canada, July 7-11, 2004 , pages 201–208, 2004.
- 8[8] P. Prosser and C. Unsworth. Rooted tree and spanning tree constraints. In 17th ECAI Workshop on Modelling and Solving Problems with Constraints , 2006.
