Presentation is loading. Please wait.

Presentation is loading. Please wait.

Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Similar presentations


Presentation on theme: "Discovering Treewidth Hans L. Bodlaender, Utrecht University."— Presentation transcript:

1 Discovering Treewidth Hans L. Bodlaender, Utrecht University

2 Algoritmiek2 This talk 1.Introduction –Definition of treewidth: a graph parameter –Applications Determining the treewidth of a graph: 2.Exact algorithms 3.Upper bounds 4.Lower bounds 5.Pre-processing Theory and experimental results

3 Algoritmiek3 I. Introduction History: resistance, laws of Ohm, series parallel graphs Definition of treewidth Applications –Hard problems becoming easier on special graphs –Probabilistic networks –PTAS’s on planar and other graphs Some useful graph theory

4 Algoritmiek4 Computing the Resistance With the Laws of Ohm R1R1 R2R2 R1R1 R2R2 1789-1854

5 Algoritmiek5 Repeated use of the rules 6 2 6 2 5 1 Has resistance 4 1/6 + 1/2 = 1/(1.5) 1.5 + 1.5 + 5 = 8 1 + 7 = 8 1/8 + 1/8 = 1/4 7

6 Algoritmiek6 A tree structure P 6262517 PP SS 5662271

7 Algoritmiek7 Network is ‘series parallel graph’ 196*, 197*: many graph problems that are hard for general graphs are easy for –Trees –Series parallel graphs Many well-known problems, e.g., maximum independent set, Hamiltonian circuit, … Using tree structures for solving hard problems on graphs 1 Linear / polynomial time computable e.g.: NP-complete

8 Algoritmiek8 Birth of treewidth Algorithms for trees and series parallel graphs can be generalized: 198*: problems solvable on decomposable graphs (Bern, Lawler, Wong; Arnborg, Proskurowski; Wimer; Borie; Scheffler, Seese; Courcelle; Lautemann; … ) –Arnborg and Proskurowski: Partial k-trees –Robertson and Seymour: treewidth (in their work on graph minors)

9 Algoritmiek9 Tree decomposition A tree decomposition: –Tree with a vertex set called bag associated to every node. –For all edges {v,w}: there is a set containing both v and w. –For every v: the nodes that contain v form a connected subtree. b c d e f aa b c c c d e h hf f a g g a g

10 Algoritmiek10 Tree decomposition A tree decomposition: –Tree with a vertex set called bag associated to every node. –For all edges {v,w}: there is a set containing both v and w. –For every v: the nodes that contain v form a connected subtree. b c d e f aa b c c c d e h hf f a g g a g

11 Algoritmiek11 Tree decomposition A tree decomposition: –Tree with a vertex set called bag associated to every node. –For all edges {v,w}: there is a set containing both v and w. –For every v: the nodes that contain v form a connected subtree. b c d e f aa b c c c d e h hf f a g g a g

12 Algoritmiek12 Treewidth (definition) Width of tree decomposition: Treewidth of graph G: tw(G)= minimum width over all tree decompositions of G. b c d e f aa b c c c d e h hf f a g g ab c d e f gh g a Width 2

13 Algoritmiek13 Useful lemmas If the treewidth is at most k, then G has a vertex of degree at most k. –There is a vertex with all neighbours in the same bag. If W is a clique in G, then a tree decomposition of G has a bag i with W  X i. –Follows from the Helly property for trees

14 Algoritmiek14 Fill-in Given a permutation  of the vertices, the fill-in graph is made as follows: –For i = 1 to n do Add an edge between each pair of higher numbered neighbours of the i th vertex 12 3 4 512 3 4 512345

15 Algoritmiek15 Alternative definition The treewidth of a graph is the minimum over all permutations of its vertices of the maximum number of higher numbered neighbours of a vertex in the fill-in graph. 12 3 4 512 3 4 5 Treewidth 2

16 Algoritmiek16 Constructing tree decomposition for fill-in graph Let v be the first vertex in  Recursively, make tree decomposition for G – v. The neighbours v form a clique in G – v. –There is a bag that contains N(v) N(v)…N(v)… i* and then…

17 Algoritmiek17 N(v)vN(v)v Constructing tree decomposition for fill-in graph Let v be the first vertex in  Recursively, make tree decomposition for G – v. The neighbours v form a clique in G – v. –There is a bag i* that contains N(v) Add a new bag containing v and its neighbours, making that adjacent to i* N(v)…N(v)… i*

18 Algoritmiek18 Applications of treewidth Graph minor theory (Robertson and Seymour) Many hard problems become linear time solvable when restricted to bounded treewidth –Optimisation –Probabilistic networks –… VLSI-layouts Compilers Choleski factorisation

19 Algoritmiek19 Many graphs have small treewidth Trees (1), series parallel graphs (2), Halin graphs (3), outerplanar graphs (2), … Graphs from some applications Many graphs have large treewidth: when containing a large grid, a large clique …

20 Algoritmiek20 Tree decompositions contain separators If neither v or w belongs to X(i) then {v,w} cannot be an edge of G. So X(i) separates vertices appearing below i in the tree from the rest of G. This allows for dynamic programming algorithms X(i)X(i) vw

21 Algoritmiek21 Dynamic programming algorithms Many NP-hard (and some PSPACE-hard, or #P- hard) graph problems become polynomial or linear time solvable when restricted to graphs of bounded treewidth –Well known problems like independent set, Hamiltonian circuit, graph colouring –Frequency assignment (Koster et al.)

22 Algoritmiek22 Dynamic programming with tree decompositions For each bag, a table is computed: –Contains information on subgraph formed by vertices in bag and bags below it –Bag itself separates this subgraph from rest of the graph –Often limited information needed Computing a table needs only tables of children and local information 1 2 3 4 6 5

23 Algoritmiek23 Probabilistic networks Underlying decision support systems Representation of statistical variables and (in)dependencies by a graph Central problem (inference) is #P-complete Lauritzen-Spiegelhalter, 1988: linear time solvable when treewidth (of moralized graph) is bounded –Treewidth appears often small for actual probabilistic networks –Used in several modern (commercial and freeware) systems

24 Algoritmiek24

25 Algoritmiek25

26 Algoritmiek26 Monadic second order logic Courcelle: Every graph problem that can be formulated in Monadic Second Order Logic can be solved in linear time on graphs with bounded treewidth –Language with constructions: Quantification over vertices, edges, sets of vertices, sets of edges (for all vertex sets W there exists an edge e, such that...) Membership tests, adjacency tests ( {v,w} in E ), Logical operations (and, or, not,...) Extended for optimisation problems (Arnborg et al, Borie et al.)

27 Algoritmiek27 Problems on planar graphs (1) Method originated by Baker (198*, 1994) PTAS for many problems on planar graphs, and extensions Extended by several authors to more general/other classes of graphs (e.g., SODA 2005: Demaine & Hajigitani – more problems and minor closed classes of graphs, van Leeuwen 2004: unit disk graphs of small density) Here: example: PTAS for independent set on planar graphs.

28 Algoritmiek28 Ingredient 1: k-outerplanar graphs Label vertices of a plane graph by level. All vertices on exterior face level 1. All vertices on exterior face when vertices of levels 1 … i are removed are on level i+1. Graph is k-outerplanar when at most k levels. Theorem: k-outerplanar graphs have treewidth at most 3k – 1. 3-outerplanar

29 Algoritmiek29 Independent set on k-outerplanar graphs For fixed k, finding a maximum independent set in a k-outerplanar graph can be solved in linear time (approximately 8 k * n time). –Dynamic programming using tree- decomposition

30 Algoritmiek30 Baker’s scheme For each i in {1,2, …, k} do –Remove all vertices in levels i, i+k, 2i+k, 3i+k, … –Each connected component of the remaining graph (and hence the remaining graph) is (k-1)- outerplanar. –Solve independent set exactly on the remaining graph. Output the best of the k obtained independent sets.

31 Algoritmiek31 Quality Look at a maximum independent set S. Each of the k runs deletes a different subset of S. So, there is a run that deletes at most |S|/k vertices from S: one of the runs gives an answer that is at least (k-1)/k times the size of the optimum. Gives: for each , there is an  -approximation algorithm whose time is polynomial in n (but exponential in 1/ .) Method has been extended in several ways.

32 Algoritmiek32 2. Computing treewidth: exact algorithms For applications: needed to compute the treewidth of a given graph –Interaction between theoretical and experimental work Overview of some results First: exact algorithms

33 Algoritmiek33 The problem Given: Graph G Question: what is the treewidth of G? Or: Give a tree decomposition with minimum (close to minimum) treewidth Decision problem version: –Given: Graph G, integer k –Question: is the treewidth of G at most k. Both of theoretical and practical interest

34 Algoritmiek34 Exact methods Arnborg, Corneil, Proskurowski, 1987: problem is NP- complete Special cases have been studied: –NP-complete for graphs of degree at most 9 (B, Thilikos), bipartite graphs, cobipartite graphs, … –Polynomial time algorithms for chordal graphs, circular arc graphs, permutation graphs, distance hereditary graphs –Open: planar graphs. (Polynomial time algorithm for the related problem of branchwidth for planar graphs.)

35 Algoritmiek35 Graphs with polynomially many separators Bouchitté, Todinca (2002, 2003): Polynomial time algorithm to compute the treewidth of graphs with polynomially many minimal separators. –Using potential maximal cliques –There is always a tree decomposition whose bags are potential maximal cliques –All pmc’s can be listed in time polynomial in nb of minimal separators (Bouchitté Todinca) –Fitting together pmc’s to make tree decomposition

36 Algoritmiek36 Fixed parameter case Important special case: k fixed Arnborg, Corneil, and Proskurowski (1987): O(n k+2 ) time Linear time algorithm, 1996: B, using a result with Kloks. –Big constant factor:  (n) time… –Hein Röhrig: feasibility study (1998). Special cases: k=1 (forests); k=2, k=3 (Arnborg, Proskurowski, 1986; Matousek, Thomas); k=4 (Sanders). –Work with reduction. To be explained later

37 Algoritmiek37 Branch and Bound algorithm Gogate, Dechter, 2004: Branch and Bound algorithm for treewidth –Builds a permutation of the vertices: For each vertex v: –Choose v as first vertex and add fill-in edges for v –Run a lower bound heuristic on the new graph and possibly stop this branch –Otherwise recurse (next time finding 2nd vertex, etc.) –Rules to limit nb of branches

38 Algoritmiek38 3. Upper bound heuristics and approximation algorithms Different methods and heuristics –Finding repeatedly separators –Refining a tree decomposition –Building a permutation Some have guarantees on performance, others not.

39 Algoritmiek39 Approximation algorithms Polynomial in n, but exponential in k: Robertson, Seymour; Lagergren; Reed; Becker, Geiger, Amir: e.g. –Algorithm that uses O(f(k) n log n) time and either tells treewidth(G)>k, or finds tree decomposition of width at most 6k. Polynomial time algorithm with O(log n) approximation ratio (B,Gilbert,Hafsteinsson,Kloks, 1995). Polynomial time algorithm with O(log k) approximation ratio: Bouchitté, Kratsch, Müller, Todinca; Amir; k optimal treewidth (2001) Amir: 720 log k in O(n 3 log 4 n k 5 log k) time.

40 Algoritmiek40 Method Procedure BuildTD (Graph G, set W) Find a set S, such that each connected component of G-S has only few vertices of W For each component Z i of G – S do –BuildTD( G[Z  S, S  (W  Z)) Fit together the tree decompositions: S  W S  W  Z 1 ) …

41 Algoritmiek41 Variants Algorithms of Robertson and Seymour, B et al, Bouchitté et al, Lagergren, Amir differ in how they find separators, what size of separators, and small other details Koster and Bouchitté et al. also have heuristics that start with one trivial tree decomposition (one bag with all vertices), and then refine.

42 Algoritmiek42 Heuristics with permutations Successful method for upper bound heuristics (Folklore): –Build in some way a permutation  of G. –Make the fill-in (perhaps during building  ) –Translate to tree decomposition Koster, B, van Hoesel 2001: experiments with several such heuristics

43 Algoritmiek43 Minimum degree heuristic Choose a vertex v in G of minimum degree Make a clique of the neighbours of v Build permutation of G-v (or tree decomposition) Add v in front (or construct tree decomposition of G) N(v)…N(v)… i* N(v)vN(v)v N(v)…N(v)…

44 Algoritmiek44 Minimum fill-in heuristic Choose a vertex v in G of such that the number of pairs of unadjacent neighbours (= nb of fill-in edges for this vertex v) is as small as possible Make a clique of the neighbours of v Build permutation of G-v (or tree decomposition) Add v in front (or construct tree decomposition of G) N(v)…N(v)… i* N(v)vN(v)v N(v)…N(v)…

45 Algoritmiek45 Experimental results Minimum degree and minimum fill-in perform very well in practice –Fast –Often best results Not always minimal triangulation –Improve result by using algorithm by Blair, Heggernes, Telle for making minimal triangulations given a triangulation

46 Algoritmiek46 Other upper bound heuristics Kjaerulff: Simulated annealing for related problem Work on genetic algorithms Clautiaux et al. (2004): Tabu search –Representing solutions by permutations, and using steps that insert vertices on different spots, etc.

47 Algoritmiek47 4. Lower bounds Useful for –Branch and bound –Informing on quality of upper bounds –Telling uselessness of treewidth approach for some graphs Joint work with Koster and Wolle

48 Algoritmiek48 Our first lower bounds Minimum degree –If G has a tree decomposition of width k, then it has a vertex of degree at most k. Helpful for improvement: –If H is a subgraph of G, then the treewidth of G is at least the treewidth of H. Degeneracy: k = 0; While G is not the empty graph do –Take a vertex v of minimum degree d –k = max(d,k) –Remove v from G The degeneracy is a lower bound for treewidth

49 Algoritmiek49 Contraction Contraction of an edge does not increase the treewidth –Take tree decomposition –If we contract {v,w}, replace v and w in each bag by the vertex representing the contraction –This is a tree decomposition of the new graph vwx vv … w... …w … xx … …x …

50 Algoritmiek50 Lower bound improving upon degeneracy –k = 0; –While G is not the empty graph do Take a vertex v of minimum degree d k = max(d,k) Contract v with a neighbour Different tiebreaking rules –Neighbour of minimum degree –Neighbour of maximum degree (bad) –Neighbour with minimum nb of common neighbours (best) Contraction degeneracy vwx

51 Algoritmiek51 Some results MMD = degeneracy MMD+ = contraction degeneracy

52 Algoritmiek52 Improvement: technique by Clautiaux et al Fact : If v and w have k+1 vertex disjoint paths and treewidth of G is at most k, then the treewidth of G + {v,w} is at most k. Initialize lower bound L. Repeat: –G’=G; –While there are non- adjacent v and w with L+1 disjoint paths (or: common neighbours) add the edge {v,w} to G’. –Compute lower bound L’ of G’. –If L’ > L then L++ Until L=L’. vwvw Any method can be used here

53 Algoritmiek53 MMDcpu MMD, MCSLBcpuMMD+cpu MMD+, MCSLBcpu link8103958.5105509.210153.6610220.71 link-pp81086.651098.011038.191050.67 munin1975.6376.3190.5792.25 munin1-pp970.9971.1480.0690.55 pignet229 ---- 31816.91311804.2 pignet2-pp302720434272919132221.3732381.36 celar06pp11 0.38110.53110.1110.58 graph1117123404.1125420.1170.07178.1 graph11-pp18131035.9131734.4160.06166.91 graph132012452341269516180.11814.96 graph13-pp20136202.51310183190.11913.77 InstanceBest LB_P(*) MMD = degeneracy MMD+ = contraction degeneracy heuristic MCSLB = maximum cardinality search heuristic

54 Algoritmiek54 Maximum Cardinality Search Simple mechanism to make a permutation of the vertices of an undirected graph Let the visited degree of a vertex be its number of visited neighbours Pseudocode for MCS: –Repeat Visit an unvisited vertex that has the largest visited degree –Until all vertices are visited

55 Algoritmiek55 Example: a 4-clique with one subdivision a b c d e

56 Algoritmiek56 We can start at any vertex: each vertex has 0 visited neighbours 00000 a b c d e a, …

57 Algoritmiek57 Say, we start at a 01101 a b c d e a, … The next vertex must be b, c, or d. It can not e.

58 Algoritmiek58 After b, we must visit c. 01211 a b c d e a, b, …

59 Algoritmiek59 And then d 01212 a b c d e a, b, c, …

60 Algoritmiek60 And finally e 01212 a b c d e a, b, c, d, …

61 Algoritmiek61 We made an MCS-ordering of the graph 01222 a b c d e a, b, c, d, e …

62 Algoritmiek62 On Maximum Cardinality Search Introduced by Tarjan and Yannakakis (1984) for recognition of chordal (triangulated) graphs Used as an upper bound heuristic for treewidth –(with fill-in edges) –Slightly inferior to minimum degree or minimum fill-in (slower and usually not better) Lucena (SIAM J. Disc. Math., 2003): method to get lower bound for treewidth

63 Algoritmiek63 Lucena’s theorem If we have an MCS-ordering of G, and a vertex is visited with visited degree k, then the treewidth of G is at least k. Task : find an MCS-ordering such that the largest visited degree of a vertex (at time of its visit) is as large as possible. –NP-hard, but heuristics Running (a few times) an MCS and reporting maximum visited degree gives lower bound for treewidth: small improvement, slower

64 Algoritmiek64 Graph or Bear?

65 Algoritmiek65 Other degree based lower bounds One-but-smallest degree is also lower bound for treewidth Ramachandramurthi: –Minimum over all pairs of non-adjacent vertices v, w of max(degree(v),degree(w) Combining these bounds with contraction gives small improvements to lower bounds LPN+ and LBP+: alternate LBN or LBP-steps with contraction: gives excellent results

66 Algoritmiek66 5. Pre-processing Translate the graph to a smaller, equivalent instance –Reduction rules –Safe separators Joint work with Koster, van den Eijkhof, van der Gaag

67 Algoritmiek67 Two types of pre-processing Reduction rules (Simplification) –Rules that change G into a smaller `equivalent’ graph –Maintains a lower bound variable for treewidth low Safe separators (Divide and Conquer) –Splits the graph into two or more smaller parts with help of a separator that is made to a clique

68 Algoritmiek68 Reduction Safe rules that –Make G smaller –Maintain optimality… Use for pre-processing networks when computing treewidth Input graph G Reduced graph H Solution H PreprocessSolve H Undo preprocessing Solution G

69 Algoritmiek69 Reduction rules Work by B, Koster, van den Eijkhof, van der Gaag Uses and generalizes ideas and rules from algorithm to recognize graphs of treewidth  3 from Arnborg and Proskurowski

70 Algoritmiek70 A safe rule Example: series rule: remove a vertex of degree 2 and connect its neighbours Safe for graphs of treewidth  2 v Series rule Original graphReduced graph

71 Algoritmiek71 Example Reduce Undo reductions a b c d e f g ab e f a b e f c g Solve a b e f ef g f e a b e f g f e b b f f c a b e f g f e b f c d c f

72 Algoritmiek72 Variable: low (integer, lower bound on treewidth) Graph G Invariant: value of max(low, treewidth(G)) Rules –Locally rewrite G to a graph with fewer vertices –Possibly update or check low We say a rule is safe, when it maintains the invariant. Use only safe rules. Type of rules

73 Algoritmiek73 Rule 1: Simplicial rule Let v be a simplicial vertex in G Remove v. Set low := max (low, degree(v)) Simplicial rule is safe. Simplicial = Neighbors form a clique

74 Algoritmiek74 Rule 2: Almost Simplicial rule v is almost simplicial, when the neighbours of v except one form a clique. If v is almost simplicial, and low  degree(v) Then remove v and turn its neighbours into a clique almost simplicial rule

75 Algoritmiek75 Generalizes: –Series rule (a vertex of degree 2 is almost simplicial) –Triangle rule (Arnborg, Proskurowski) Is safe –tw(G’)  tw(G) –Tree decomposition of G can be made from one of G’ by adding one node with cardinality degree(v)+1  low+1 On the almost simplicial rule … …

76 Algoritmiek76 Buddy rule If: –Low  3 Then –Remove v 1 and v 2 –Add edges between x 1, x 2 and x 3. buddy rule v1v1 x1x1 v2v2 x1x1 x3x3 x2x2 x2x2 x3x3 Generalization: Buddies rule: d vertices, each with the same d+1 neighbours

77 Algoritmiek77 (Extended) Cube rule If low  3 Also from work of Arnborg and Proskurowski

78 Algoritmiek78 Some results for probabilistic networks Sometimes to optimality; often significant reductions

79 Algoritmiek79 Experiments Some cases could be solved with pre-processing to optimality Often substantial reductions obtained Applied to instances obtained from `real’ probabilistic networks Time needed for pre-processing was small (never more than a few seconds)

80 Algoritmiek80 Safe separators S is a separator of G, if G-S has more than one connected component S is a minimal separator, if S is a separator and S does not contain another separator as proper subset S

81 Algoritmiek81 Safe separator S is safe for treewidth, or `a safe separator’ iff –The treewidth of G equals the maximum over the treewidth of all graphs obtained by Taking a connected component W of G-S Take the graph, induced by W  S Make S into a clique in that graph +

82 Algoritmiek82 Using safe separators Splitting the graph for divide and conquer pre- processing Until no safe separators can be found Slower but more powerful compared to reduction –Most or all reduction rules can be obtained as special cases of the use of safe separators Look for sufficient conditions for separators to be safe

83 Algoritmiek83 A theorem The following separators are safe: –Separators of size 0, 1 –Minimal separators of size 2 –Minimal separators of size 3 that split off at least two vertices –Clique separators –Minimal `almost clique’ separators: S is an almost clique when S – v is a clique for some v

84 Algoritmiek84 On safeness of clique separators If S is a clique separator, then the treewidth of G equals the treewidth over all components W of G – S of G[S  W]. Subgraphs cannot have larger treewidth

85 Algoritmiek85 On safeness of clique separators If S is a clique separator, then the treewidth of G is equals the treewidth over all components W of G – S of G[S  W]. A tree decomposition can be build from tree decompositions of the subgraphs

86 Algoritmiek86 Splitting on an almost clique separator

87 Algoritmiek87 An almost clique separator is safe Each smaller graph we look at can be obtained by contracting edges in G –So has treewidth at most the treewidth of G A tree decomposition of G can be build from tree decompositions for the smaller graphs

88 Algoritmiek88 An almost clique separator is safe Each smaller graph we look at can be obtained by contracting edges in G –So has treewidth at most the treewidth of G A tree decomposition of G can be build from tree decompositions for the smaller graphs

89 Algoritmiek89 Plan Search safe separators of size 1, 2, 3, clique and almost clique separators. Repeat on parts; possibly combining for speed with reductions. When pre-processing stops, apply other methods: –E.g.: Branch and Bound –Or heuristics. E.g.: apply a heuristic first on each part, and then try to improve (e.g., with B&B) the most expensive parts.

90 Algoritmiek90 Some results for probabilistic networks

91 Algoritmiek91 Conclusions Treewidth is a useful tool to solve graph problems for several special instances, both for theory and for practice Theoretical results with additional ideas give practical algorithms that work in many cases well Algorithms of different types: exact, upper bound heuristics and approximations, lower bounds, pre- processing


Download ppt "Discovering Treewidth Hans L. Bodlaender, Utrecht University."

Similar presentations


Ads by Google