A Complete Anytime Algorithm for Treewidth
Total Page:16
File Type:pdf, Size:1020Kb
UAI 2004 GOGATE & DECHTER 201 A Complete Anytime Algorithm for Treewidth Vibhav Gogate and Rina Dechter School of Information and Computer Science, University of California, Irvine, CA 92967 fvgogate,[email protected] Abstract many algorithms that solve NP-hard problems in Arti¯cial Intelligence, Operations Research, In this paper, we present a Branch and Bound Circuit Design etc. are exponential only in the algorithm called QuickBB for computing the treewidth. Examples of such algorithm are Bucket treewidth of an undirected graph. This al- elimination [Dechter, 1999] and junction-tree elimina- gorithm performs a search in the space of tion [Lauritzen and Spiegelhalter, 1988] for Bayesian perfect elimination ordering of vertices of Networks and Constraint Networks. These algo- the graph. The algorithm uses novel prun- rithms operate in two steps: (1) constructing a ing and propagation techniques which are good tree-decomposition and (2) solving the prob- derived from the theory of graph minors lem on this tree-decomposition, with the second and graph isomorphism. We present a new step generally exponential in the treewidth of the algorithm called minor-min-width for com- tree-decomposition computed in step 1. In this puting a lower bound on treewidth that is paper, we present a complete anytime algorithm used within the branch and bound algo- called QuickBB for computing a tree-decomposition rithm and which improves over earlier avail- of a graph that can feed into any algorithm like able lower bounds. Empirical evaluation of Bucket elimination [Dechter, 1999] that requires a QuickBB on randomly generated graphs and tree-decomposition. benchmarks in Graph Coloring and Bayesian The majority of recent literature on Networks shows that it is consistently bet- the treewidth problem is devoted to ¯nd- ter than complete algorithms like Quick- ing constant factor approximation algo- Tree [Shoikhet and Geiger, 1997] in terms of rithms [Amir, 2001, Becker and Geiger, 2001]. Other cpu time. QuickBB also has good anytime heuristic algorithms include popular triangulation performance, being able to generate a bet- heuristics like min-degree, max-cardinality search ter upper bound on treewidth of some graphs and min-¯ll. These heuristics have no performance whose optimal treewidth could not be com- guarantees and the approximation computed by them puted up to now. can be exponentially bad. We discuss these heuristics in the Section 3. It is well known that the speed of a branch and 1 Introduction bound algorithm depends upon the quality of the lower bound used. In this paper, we have developed a new lower bound called minor-min-width that Given an undirected graph G and an integer k the is shown to produce a better lower bound than problem whether the treewidth of G is at most k is max-cardinality search developed recently by Brian known to be NP-complete [Arnborg et al., 1987]. In Lucena [Lucena, 2003]. We implemented a branch this paper, we develop a complete anytime algorithm and bound algorithm using minor-min-width as based on branch and bound search to solve the lower bound. However this implementation did not optimization version of this problem. In other words, terminate on some graphs having 20 vertices in 2 we are interested in the smallest such k. The problem days of cpu time. Some analysis revealed that this can also be rephrased as ¯nding a triangulation or naive algorithm can be improved with some clever tree-decomposition T of G such that the treewidth of modi¯cations along two directions: (1) Reducing the T is same as G. branching factor at each state, (2) Using pruning and A solution to this problem is important because 202 GOGATE & DECHTER UAI 2004 propagation rules to prune regions of the search space The width of a tree-decomposition is given by: maxi2I that can not be a part of a triangulation having a (jÂij ¡ 1). The treewidth of a graph G denoted by lower treewidth than the current best. tw(G) equals the minimum width over all possible tree We reduce the branching factor by using Dirac's decompositions of G. The treewidth of G is the mini- theorem which characterized triangulated graphs and mum k ¸ 0 such that G is a subgraph of a triangulated graph minor theory. Also, we derive various pruning graph H having a maximal clique of size k + 1. and propagation rules from the theory of graph De¯nition 2.3. A vertex v of G is simplicial if its minors and graph isomorphism. We call the resulting neighborhood induces a clique. A vertex v is almost algorithm QuickBB. simplicial if all but one of its neighbors induce a Prior to our work, the best existing com- clique. An ordering of the vertices ¼ = [v1; v2; : : : ; vn] plete algorithm for ¯nding optimal triangulation is called a perfect elimination ordering if for ev- is due to Shoikhet and Geiger(called Quick- ery 1 · i · n, vi is a simplicial vertex in G[X] where Tree [Shoikhet and Geiger, 1997]). Our empirical X = fvi; : : : ; vng. evaluation on randomly generated graphs shows De¯nition 2.4. A clique of size k + 1 is a k-tree of that QuickBB is superior to QuickTree. On some size k + 1.A k-tree of size n + 1 can be constructed randomly generated graphs with 100 vertices and from a k-tree of size n by taking the new vertex and treewidth bounded by 10, QuickBB appears to be making it adjacent to any clique of size k in the k-tree. 50 times faster than QuickTree. Being a branch and A subgraph of a k-tree is called a partial k-tree. bound algorithm, QuickBB also has good anytime properties. We were able to obtain better upper Lemma 2.5. The treewidth of a k-tree is k. The bounds on treewidth of some graphs in Dimacs Graph treewidth of a partial k-tree is at most k. coloring benchmarks and Bayesian Network repository even when the algorithm did not terminate. A characterization of the triangulated graphs is given by the following lemma. Lemma 2.6. A graph is triangulated i® there exists 2 De¯nitions and Preliminaries a perfect elimination ordering for it. Also, if a graph is triangulated then any simplicial vertex can start a Note that all the lemmas presented in this sec- perfect elimination ordering for it. tion can be found in a book on treewidth by Ton Kloks [Kloks, 1994]. All the graphs used in this pa- Another important property is due to Dirac. per are ¯nite, undirected, connected and simple. We Lemma 2.7. Any non-clique triangulated graph has denote an undirected graph by G(VG;EG) where VG at least two non-adjacent simplicial vertices. is the set of vertices of the graph and EG is the set of edges of the graph. The neighborhood of a vertex v The relation between the treewidth of a triangulated denoted NG(v) is the set of vertices that are neighbors graph and perfect elimination ordering is captured by of v. A chord of a cycle C is an edge not in C whose the following lemma. endpoints lie in C.A chordless cycle in G is a cycle of Lemma 2.8. Given any perfect elimination ordering length at least 4 in G that has no chord. f = [v1; : : : ; vn] of a chordal graph T , the treewidth of De¯nition 2.1. A graph is chordal or triangulated T is given by max(jN(vi)j j v 2 V; N(v)\fvi; : : : ; vng) if it has no chordless cycle. A graph M is a minor of a graph G if graph M can be obtained from a subgraph of G by edge contraction. A graph G0 = (V 0;E0) is called a subgraph of G if Edge contraction of an edge e = fu; vg is the operation V 0 ⊆ V and E0 ⊆ E. If W ⊆ V is a subset of vertices of replacing both u and v by a single vertex w such that then G[W ] denotes the subgraph induced by W .A the neighbors of u and v are neighbors of w except u clique is a graph G that is completely connected. A and v themselves. A relation between graph, its minor triangulation of a graph G is a graph H such that G and the treewidth of G is given by the following lemma. is a subgraph of H, H has the same set of vertices as G and H is chordal. Lemma 2.9. Let G be a graph and M be a minor of G. Then tw(G) ¸ tw(M). De¯nition 2.2. A tree decomposition of a graph G(V; E) is a pair (T;Â) where T = (I;F ) is a tree and We say that we eliminate a vertex v when we make  = fÂi j i 2 Ig is a family of subsets of V such that: v simplicial and remove it from the graph to obtain S 0 (1) i 2I Âi = V , (2)For each edge e = fu; vg 2 E a new graph G . This operation will be denoted by there exists an i 2 I such that both u and v belong elim(G; v) and it returns a graph G0 = (V n v; E [ 0 0 to Âi and (3) For all v 2 V , there is a set of nodes E ); where E = f(v1; v2)jv1; v2 2 N(v)g. Given a fi 2 Ijv 2 Âig forms a connected subtree of T . linear ordering f = [v1; : : : ; vn] of an undirected graph UAI 2004 GOGATE & DECHTER 203 G, a triangulation T of the G along the ordering can 4 Lower bound on treewidth be obtained as follows.