Advanced Graph Algorithms Jan-Apr 2014 Lecture 6 January 15, 2014 Lecturer: Saket Sourah Scrie: Prafullkumar P Tale 1 Overview In the last lecture we defined simple tree decomposition and stated that for given graph G if (T, f) is simple tree decomposition then V (T ) V (G). In this lecture, we will prove the aove result and introduce the concept of nice tree decomposition and how to convert simple tree decomposition to nice tree decomposition without increasing its tree width. We conclude this module with application of dynamic programming, using tree decomposition, to find the independent set of graph. 2 Simple Tree Decomposition Definition 1. For given graph G and its tree decomposition (T, f); T is said to e simple tree decomposition if for any two distinct nodes t 1 and t 2 in V (T ), neither f(t 1 ) f(t 2 ) nor f(t 2 ) f(t 1 ). Lemma 2. For given graph G and its simple tree decomposition (T, f), V (T ) V (G). Proof. Pick an aritrary node r V (T ) and consider T as a rooted tree with r as the root. By the connectivity property of tree decomposition, for every vertex v V (G) the set { v f()} induces a connected sutree of T. Thus there is a unique node v V (T ) which is the node of T closest to r out of all nodes in { v f()}. We say that v peaks at v. Each vertex v V (G) peaks at exactly one node v in V (T ). We argue that for every node V (T ) there is a vertex v V (G) that peaks at. Suppose not. If is the root r this implies that f() = φ, contradicting that (T, f) is simple as f() will e contained in all f( 1 ) where 1 V (G) and 1. If is not the root r then has a parent which is closer to the root r. Since no vertex v V (G) peaks at it follows that f() f( ) contradicting that (T, f) is simple. We now have that every node of V (T ) has some vertex G that peaks at it, and every vertex v of G peaks in exactly one node of T. Thus V (T ) V (G). 1
3 Nice Tree Decomposition Definition 3. A tree decomposition (T, f) of G is called nice if it has the following properties P1 T is root at node r P2 f(r) = 0 and for every leaf l, f(l) = φ P3 every node in in T has at most 2 children P4 If has 2 children, say, 1 and 2 then f() = f( 1 ) = f( 2 ). P5 If has only one child, say, 1 then one of the following two conditions is true. (i) f( 1 ) f() and f() = f( 1 ) + 1 (ii) f() f( 1 ) and f( 1 ) = f() + 1 Consider the graph given in Fig 1 and its tree decomposition in Fig 2. a c d e f g Figure 1: Graph G a c cd de df dg a ac cd cde d dfg g Figure 2: Nice Tree Decomposition of graph G For node, if the first case of property P5 holds, then it is known as introduce node. If later case holds, we call it forget node. Lemma 4. If graph G has tree-decomposition of tree-width k then it also has a nice tree decomposition of the same tree width. Furthermore, given any tree decomposition, we can construct nice tree decomposition in polynomial time. 2
Proof. We start with considering T as an unrooted tree and setting (T, f ) = (T, f). We then proceed to modify (T, f ) in order for it to have the desired properties. Throughout the process we will maintain that (T, f ) is a tree decomposition of G of width k. First we add to every leaf l of T another leaf l and set f (l ) = φ. Then we select an aritrary leaf of T, call it r and root the tree T at r. At this point (T, f ) is a tree decomposition of G satisfying properties P1 and P2. As long as T has a node V (T ) with more than two children, we proceed as follows. Let 1, 2... p e the children of. We make a new node and add it to T in the following manner. The parent of is set to, and for each child i of with i 2 we make the parent of i instead. Finally we set f ( ) = f (). This operation maintains that (T, f ) is a tree decomposition of G. Furthermore now only have two children namely 1 and. The prolem has shifted from to ut has degree one less than what had efore this step. Hence each step adds one node to the tree T and for one vertex with more than two children, decreases the numer of children y 1. We will continue this process till all the nodes in T has at most two children. At this point (T, f ) is a tree decomposition of G satisfying properties P1,P2 and P3. Following is the simple illustration of the process when has three children. 1 1 2 3 with more than two children 2 3 Introducing so that now has two children We now run a new process, aimed to make (T, f ) satisfy property P4. As long as there exists a vertex V (T ) with 1, 2 its children and f () f ( 1 ) f ( 2 ), we proceed as follows. We add two new nodes 1 and 2 to T. Make the parent of 1, 2 and change the parent of 1, 2 to e 1, 2 respectively. We set f ( 1 ) = f ( 2 ) = f (). At the completion of step the numer of vertices in V (T ) which contradicts to property P4 is reduced y one. Hence, after finite iterations (T, f ) is a tree decomposition of G satisfying properties P1,P2,P3 and P4. Following diagram illustrate this step. 1 2 1 2 f () ( 1 ) ( 2 ) 1 2 f () = f ( 1 ) = f ( 2 ) Finally we run a process aimed at making (T, f ) satisfy property P5. Consider there exist vertex in V (T ) with child 1 such that f() f( ) and f() + k = f( ) for some constant integer k > 1. We will introduce new vertex as child of and make parent of 1. Let u f( 1 )\f(). Assign f ( ) = f () u. After this step, satisfies the property P5 ut violate it. But, now 3
the difference etween f( ) and its child f( 1 ) is k 1. Hence after k iterations, all the newly introduced vertices in the path to 1 will satisfy the property P5. For vertex c in V (T ) with child c 1 such that f(c) f(c 1 ) and f(c) = f(c 1 ) + k. We introduce new vertex c in similar way ut we assign f (c ) = f (c)\{u} where u f (c)\f(c 1 ). The total numer of steps in all of the processes descried aove is O(kn) since each step adds a new node to T. With appropriate data structures, each step of each process can e completed in time O(k O(1) ) and hence we can construct nice tree decomposition in polynomial time. 4 Dynamic Programming Many algorithms on trees are ased on dynamic programming and are polynomial time solvale. We defined tree width to measure how accurately a given graph can e approximated to tree. Lower the tree width of graph, more closely it can e associated with tree. Thus it is natural to think that some of the dynamic programming algorithms that work for trees could e lifted to also work on graphs of ounded treewidth. This turns out to e the case with a few notale exceptions most prolems that are polynomial time solvale on trees are also polynomial time solvale on graphs of ounded treewidth. We will use the independent set prolem as an example to illustrate this concept. Before jumping into the dynamic programming, we will first define some useful concepts. T is tree rooted at and defined as T = {w w is an descendant of in T } {}. Definition 5. For given graph G and its tree decomposition (T, f), for V (T ) define set V = w T f(w) V (G) is divided (note that it is not a partition) into V for all V (T ). Define V 1, V 2 V (G) as V 1 = V and V 2 = x V (T )\T f(x). Since G is t- decomposile, removing t+1 points will disconnect the graph and hence V 1 V 2 t + 1. Definition 6. For given graph G and V V (G), oundary of V is defined as Z V V, (v, w) E(G) and w V (G)\V } = {v v Since graph is t decomposile, Z V i t + 1 for any V i V (G). Let us consider the following example. We define function β : V (G) 2 V (T )\φ and function f : V (T ) 2 V (G) as written in the tale. 4
v β(v) 1 {e} 2 {c, e} 3 {a} 4 {a, } 5 {, d, f} 6 {, d, f, g} 7 {h} 8 {f, h, i, j} 9 {d, g, k, l} 10 {i} 11 {j} 12 {k} 13 {l} x f(x) a {4, 3} {4, 5, 6} c {4, 2} d {5, 6, 9} e {2, 1} f {5, 6, 8} g {6, 9} h {7, 8} i {8, 10} j {8, 11} k {9, 12} l {9, 13} 1 2 3 4 5 6 a 7 8 9 c 10 11 12 13 f d g e h l i k In the aove example, following are some of the susets and their oundaries V h = {7, 8, 10, 11}; Z Vh = {8} V f = {5, 6, 7, 8, 9, 10, 11}; Z Vf = {5, 6} V d = {5, 6, 7, 8, 10, 11, 9, 12, 13}; Z Vd = {5, 6} The idea is to store sufficient information in the oundary of the suset which will help us to determine Independent set of entire graph y looking only at oundary. For V V (G) Let us define the following collection of sets F = {A V i A is independent set of G and V i V } j 5
Definition 7. For given graph G its independent set A we define A 1 = A V and A 2 = A\A 1. We say F is good family if there exist B F such that 1. B Z V = A 1 Z V 2. B A 2 is an independent set. 3. B A 2 > A. But the size of family can e as large as 2 V (G). We can reduce the upper ound on the size of set y defining following collection of sets. ˆF V (Z ) = {X X F V and X Z = Z } where Z Z. This definition allow us select the etter candidate among the V i and leave out the candidate which forms the su-optimal solution. We can reduce our focus to the aove set. Since the size of oundary is ounded we now have 2 t+1 possile susets. Now instead of working on graph G, we will work on its tree decomposition. As proved earlier, every graph has nice tree decomposition. We only need to see procedure at different type of nodes of nice tree viz leafs, nodes which has two children and introduce node or forget node. We now descrie the procedure and prove that the i th family computed is good, y induction on i. First we compute the family F for every leaf, and sets F = {φ}. Since (T, f) is a nice tree decomposition of G it follows that f() = φ and therefore V = φ. Thus, for any optimal solution OP T of G, there is a set B F, namely B = φ, such that B f() = OP T f() = φ and (OP T \V ) B = OP T is an optimal solution to G. Assume now that families of the i first nodes processed y the procedure are all good, and consider the i + 1 st node V (T ) to e processed. If is a leaf we have already shown that F is good, so assume now that is not a leaf. All the children of have een processed. The node has one or two children in T, since (T, f) is a nice tree decomposition. If has one child 1 then F 1 is good y the induction hypothesis. Similarly if has two children 1 and 2 then F 1 and F 2 are oth good y the induction hypothesis. It suffices to show that, in either case, the family F is good. If has two children 1 and 2 then F = {X 1 X 2 X 1 F 1, X 2 F 2 and X 1 f() = X 2 f()}. We wish to prove that F is good. To that end, consider any optimal solution OP T V (G). Since F 1 is good there is a set X 1 F 1 such that OP T 1 = (OP T \V 1 ) X 1 is an optimal solution as well, and X 1 f() = OP T f(). Here we used that (T, f) is a nice tree decomposition, and that therefore f( 1 ) = f( 2 ) = f(). Similarly, since F 2 is good there is a set X 2 F 2 such that OP T 2 = (OP T 1 \V 1 ) X 2 is an optimal solution, and X 2 f() = OP T 1 f(). Consider the set X = X 1 X 2. The definition of F implies that X F, and OP T 2 = (OP T \V ()) X is an optimal solution as well. Finally X f() = OP T f(). We conclude that in this case F is good. If has one child 1 then F = {X 1 S X 1 F 1 and S f()\f( 1 )} 6
We wish to prove that F is good. To that end, consider any optimal solution OP T V (G). Since F 1 is good there is a set X 1 F 1 such that OP T 1 = (OP T \V 1 ) X 1 is an optimal solution as well, and X 1 f( 1 ) = OP T f( 1 ). Let S = OP T (f()\f( 1 )), and oserve that S satisfies S = OP T 1 (f()\f( 1 )) as well. Let X = X 1 S, we have that X F 1, OP T 1 = (OP T \V ) X is an optimal solution, and OP T f() = S (X 1 f(1) f()) = X f(). Thus F is good family, concluding the proof of correctness of the procedure. 7