CS 627 – Advanced Algorithms (Winter 2026-27) · unit page · YouTube
2026-11-19, 25:27

Click any sentence to play from there.

The transcript was generated automatically by YouTube's speech recognition and is offered as is. It may contain errors, in particular concerning technical terms, names and formulas.

0:03 So in the next section we'll look at a structural parameter uh specifically for graphs called tree width that expresses a very different kind of phenomenon that when graphs are small or I mean have little width in this terminology certain problems become easy for an entirely different reason. I think this is is a very interesting uh different angle. It of course uses the same terminology fixed parameter attractability and these things uh but from um a very different maybe a more applied standpoint if you like but also has a cool graph theory behind it. So, so far we've mostly looked at parameters representing the solution size and we could also look at the structure of the input as a vague concept and I want to show the simplest and and most intuitive one here.

0:57 Um, another motivation is that for very very restricted kind of graph problems looking at trees as a special case makes them usually very easy. Um we'll look at uh our favorite example again. So um almost favorite example. Uh let's look at uh independent set for for this one. Um the rough road map is well I'll motivate why looking at separators is a very natural thing if you optimize problems over graphs. um and then I'll I'll try to give you an intuitive definition of tree width um with some equivalent formulations that I won't prove. I'll just showcase them because they're cute, but uh we'll we'll see. Um the most the most useful part of this unit will be the final part of bringing this into an algorithm which is a again a general design principle for algorithms of this type. It's a dynamic programming over some some hierarchical structure in in the input graph um that is more versatile than just the part that I'm showing here. I'll I'll comment on that. Well, let's uh let's first see why such a thing might even work. And let's look even at independent set which we know for the classical parameterization would have been W1 hard and nothing seems to give.

2:31 But let's look at trees as an in an easy instance. How can you solve a independent set on trees? And here let's even give the vertices some weight to make the whole thing a bit more spicy. So every vertex has a number and we're trying to find the independent set of the total maximal weight. If you set everyone to one, then that's the same as the original problem. Now, uh, it's easy to solve on trees because you can decide, um, I'm going to pick a root for my tree. And at every vertex, um, let's say this one, I can decide whether I'm taking that vertex or not taking that vertex into my independent set.

3:21 in of v gives me the value of the independent set I can I can get if I include my vertex v and then uh obviously I cannot take my adjacent vertices so not my children and not my parent and similarly if I decide I'm not going to take v maybe because I was recursively called like this then um for my children I have the choice whether I include them or And you can follow this, you can do this um in a in a bottomup traversal.

4:06 Thanks. Um so bottom up traversal I can fill in and out for each vertex by just looking at the children. And then at the root I don't have a parent to worry about and so I can just decide is it better to include the root or not and that's all. So I can solve independent set even weighted on trees in linear time much much easier than uh on anything of a more general graph where we struggle to do anything even parameterized.

4:39 So um maybe there's an in between between trees and general graphs and that's the notion uh that we're looking at here. Uh but let's let's try to stick with the example for a bit and analyze why it is so easy here or why it is so efficient. And the reason is if I if I look at some vertex here um the decision whether I include it or not has very local influence whether I include V or not doesn't directly influence say these siblings on the other side because even if I include V I mean it has influence via the parent but if you go bottom up all that's influenced from V is the layer directly below it. And one reason why that is is if you take V and were to delete it.

5:36 This separates the graph into disconnected parts where uh for many problems independent set is one. And you can think of other favorite optimization problems on graphs. If there's no edges to connect the parts, they don't talk to each other. you can independently find the best solution in each. Now, it's it's not 100% true, right? We we still have to take um into account whether or not these optimal solutions already include this uh child or not. So, we need to keep a little flexibility, but the flexibility is very limited here. It's extremely limited. There's just two options for every component. I need to keep track of true of two solutions, the best with and the best without that specific root vertex of the sub tree.

6:26 And so that's that's what we what I mean here by an interface of size one. There's this one vertex and um that decides whether it's in or out. And by doing the same recursively, I can uh optimally combine sub problems.

6:43 And tree width is the attempt to generalize that when the size of this interface is not exactly one but still somehow bounded. And of course, if you think about some general graph where maybe it's highly connected, you're not going to find such a small interface. In principle, if the connections go all all over the place, um removing one vertex wouldn't really disconnect the graph.

7:18 Okay. So, what is tree width? Uh tree width is based on this notion of tree decompositions. And I I think the notion of tree decomposition is a horribly unintuitive notion. I'm going to first tell you the formal definition, but then I'm going to try to make it more intuitive. Um, it's called tree decomposition because it is a tree, but the the tree is somehow awkward. It doesn't directly have to do with your graph. It seems almost a tree decomposition for a graph is a tree and the vertices of this or the nodes of this tree are bags, subsets of vertices in the original graph. And uh for every such note in our tree, we have three properties um or well uh there's there's three properties for the total tree decomposition. I think better way to say it. First of all, um every vertex of the original graph is contained in at least one of the bags, one of the tree bags.

8:21 Example coming up soon. Um, for every edge in the original graph, there is a bag where the end points are jointly contained in that bag. And lastly, for every vertex in the original graph, if you look at all the bags that contain V, these must form a connected subgraph of T.

8:43 All of this sounds rather mysterious. Um, hopefully in a in a few minutes time a bit less. So the width of such a tree composition is simply the largest bag that you use and you subtract one because we really want that trees have width one. Um which also means I should be able to do this decomposition on a tree using only bags of size two. Maybe that's the the first um thing to think about.

9:20 But uh let's some even more trivial observations first. I can always take the entire graph throw all the vertices in one giant bag. So the tree is just one node that satisfies all the constraints. So it gives me that every graph has has three width at most n minus one. The point is that uh the the the definition gets interesting if you try to get small width and so that's why we ask you for the minimum width of any uh allowed valid 3D decomposition of the graph. Okay. Uh let's let's look at a small example here first. This is not a tree maybe. Um let me check if that is easy to do. Yeah, let's do a tree first and maybe we can do this a little bit interactively.

10:19 Uh here's a tree. Uh and let's try to build backs so that we satisfy the constraints of a tree composition. The three properties are here again if if you can read that. Um, any suggestions how to start.

10:48 So, first hint, we should get by with bags of size two because the tree width of a tree should be one. Second, we need every edge needs to be connected in an in a bag. At some point I need both endpoints in one back. So we will need one back per edge, right? This is um inevitable. Now uh the only thing that that that's kind of easy. Uh the only thing that we need to take care of is this last constraint which says if I have a vertex in backs, this must be connected. So the safest seems to me to be uh connecting leaves where we don't run into this trouble. I I will never have to connect eight to anything. So that seems seems rather safe.

11:39 Um now because we started with a seven, I think we should continue with the seven. So let's lump these two together. Now um the seven now is contiguous. And luckily there's no more edges with seven. So I can forget about seven. Uh, but I've I've added three here now. So, I should keep going with three. So, let's do these two. Now, six is great. That's a leaf. Only one edge is not a problem. The three needs to continue because otherwise it its component wouldn't be connected. So, we have to do this one next. And so, you see what we're kind of doing. It's it's almost like walking along the tree, right? And I can uh just finish this. Okay. 3D compos. Oh, I forgot about that. Yeah, I was in a playful mood. Um, in this case, the tree decomposition is even a path. That's another special case. And I guess you can always make that a path if you start with a tree the way I've just done.

12:49 Let's do a slightly more interesting example. Um here you will not get by with just um width two. So let's not even try. But let's try the same approach. Um from what you've seen, chipping away leaves sounds like a safe start, right? So maybe we do that.

13:15 And maybe this is okay. I don't need to add more now. Uh we could try to keep going like this. So maybe this can be a bag.

13:32 now I'm a bit in trouble. If I were to continue with seven and eight, I would leave out the six, but I have to come back later to get get the other edge covered. And likewise, if I were to um continue down here and leave the uh continue up here and leave the eight alone, then um I would have to cover that later. So the only way to keep this adjacent is to include these together.

14:01 So what what I'm doing is I'm I'm walking through the graph making sure that all the vertices that are still somehow active in an edge are um included together.

14:15 Now maybe this is a mistake. Now, let me think. So, these are these are all done. Hold on. Um, but I have both both the the one and the two active. So, I have to keep them both. But the the zero is fine. Now, the one is safe. I can leave that out.

14:47 I did it. Okay, I should have practiced more. Um, maybe this already hints at some equivalence. Uh, I'll I'll try to come back to this in a second. Uh, here's a a worked example where um it follows kind of the same principle. So, um, AB D is this first set. Maybe I can add these here. here. And you see from ABD we go to BDE and then we go to BCE E and then to CF. Now uh in general this need not be a path. There might be branches but it's always a tree. So in a way you can still think of walking along this. Um we've seen a more interesting example I think. um in the animation. So maybe this is fine. Uh but note that here uh we could have extended this to any wider graph by just keeping walking. Now maybe let me do this one more time on this example on a slightly bigger one just to hammer that point home again.

16:08 If you have some some graph like this, you want to start at one end and then always keep the point that you've that is that has open edges.

16:21 You want to keep that in your active set. But then otherwise you um wiggle your way through. I could change directions. Go down first. This doesn't matter.

16:48 Okay. It doesn't even let me add the last bag. So this this generalizes even if the graph becomes bigger and bigger, the width stays constant in this case. If it's a 2 * m ladder like in this case. Okay.

17:09 Why intuitively do we do this? So far this seems not to be all that connected to my independent set argument for trees that somehow the different parts don't talk. And uh the key observation is that these bags are indeed separators. Every bag splits the graph into disconnected parts. And that has to be true for every bag. Um well first formally like um if you have two uh two backs an edge between a back between two backs in the 3D composition. If you were to remove the edge between two bags then um that splits the tree into two parts. The tree is always um one connected right? So it uh falls into two trees where each of the endpoints is contained in one. And if you look at the vertices that are in all the bags of one tree and all the vertices in the backs of one in another tree, uh then there is no edge connecting these two. Um if you remove the vertices of both of the involved backs. I think I slightly lied there. Right? You need to take an edge from the tree composition and both involve bags are deleted from the graph and prove by a small example.

18:35 Uh if you take a vertex in this in this set here. So maybe it starts first with the tree composition. That's the example from before. Suppose I remove this edge between two and three between backs two and three. Um and uh sorry this uh I misspoke. We we take the intersection between the between the bags the B and E that's the separator. If I take out B and E the two vertices in the original graph then it falls apart into a green and a blue part. And so if if you take some vertex here in the blue part and some vertex here in the green part, let's see how the uh axioms of the 3D composition give us that they can't have an edge between them. Well, by this let's maybe uh for for those who like me can't remember these three axums, let's copy them to the slide.

19:50 I'd have to copy them several times. Let's uh keep that. Well, two says there's for every edge there's a back where this edge is joined. So if U and V is supposed to be an edge in the graph, then there must be some back that contains both of the end points. Now where can that back be? Suppose it's in T1 in the blue part arbitrarily.

20:17 Uh but then this um why the picture is gone now is not clear to me. Then this vertex V appears in T1 and in T2 because it was from V1 uh V2 and is also in this bag. So it appears in both trees. But then the third property says if uh I take all the backs of one vertex these should be connected. So um it should be also in the two backs that I walked over the unique edge joining the two paths that I removed now. But I mean I didn't have it in this in this intersection because by definition it wasn't. So that's a contradiction. So I can never have um an edge between these two parts. If I cut the 3D composition at any edge, that corresponds to a separator in the graph taking the intersection of the two backs.

21:25 And so small width is the same thing as everywhere having small separators. And that works very well for trees. It matches exactly what trees are special for. Any vertex separates a tree into two parts. And um it's a bit stronger. It it needs the same thing there and recursively everywhere else.

21:56 Let's um let's see that in action as well. First of all, um if I take any any edge here, it corresponds to two vertices in intersection in in this example. And indeed, if I take these two vertices out, the graph graph falls apart into two parts. Uh but let's also try to find this again on some some example.

22:27 Okay, let's see if I can if I can do it. Um let's say uh this is a separator right now. Um in the in the blue part I could continue with I have to take all three. That is a bad decomposition.

22:59 This is valid. uh is not the optimal 3D composition that I get from this. Um let's try again. Let's start with three vertices because we will in the end need three.

23:39 I think I messed up again. Okay, let's let's help let's have the algorithm help. I should have started with 017. Okay, as we did before.

23:55 Okay, this this just walks along the same as we did before. Um, how about this? So, this is one separator and it cuts off this other single one.

24:36 I always get a size four here. Okay. Um I need to practice this part more. I mean, we've we've already seen how to construct a 3D composition of the optimal way with this walking step. I think there's a way to also get from separators right to the 3D composition. But maybe this is uh less intuitive than than the other one to just walk along. If you have your 3D composition built, uh let's take say maybe this this example again. Any edge you pick in the 3D composition, there's a a certain intersection among the two bags. And this is a separator in the graph. This is always true. That's what we just proved in the lema. Um here it's these two. I might even cut it in in more than two pieces. Okay.

← Video 6-7: Subexponential Algorithms and ETHVideo 6-9: Treewidth Properties →