Video 6-9: Treewidth Properties
CS 627 – Advanced Algorithms (Winter 2026-27) · unit page
· YouTube
2026-11-23, 27:16
← Video 6-8: Tree Decompositions and SeparatorsVideo 6-10: DP over Tree Decompositions →
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 the tree composition needs to fulfill these these three properties down here. Every vertex in the graph is contained in some of these bags. Every edge needs to be in one of the bags in the sense that together the two endpoints are in a bag. And I invented this this cute way of drawing things so that you can see a bit more where it comes from. So the the local coordinates are kept which make it a little easier to see that the edges are indeed covered. And crucially the the last part if you take any specific vertex then its bags where it occurs, they need to form a connected component in this tree. And that is ultimately any of the constraints of course if you drop them you kind of make the problem easier. But this this last one is is crucial for having a tree decomposition. And we'll see how this in in proofs pops up as a critical thing.
1:07 Okay. And then the tree width is defined as the smallest maximal bag. So in any tree decomposition find the best tree decomposition with the smallest width. But then in in a specific decomposition the width is the size of the largest bag minus one. That we've covered and we've seen this crucial connection. Any tree decomposition gives you a separators in the graph in the sense that any edge in the tree decomposition defines an intersection of the adjacent bags. Also here the example again. If you take any edge in the tree decomposition then there's an intersection of the adjacent bags. It I mean it might be a single vertex. If it's empty then the graph needed to be disconnected I guess. Um, uh, if there's any intersection here, then this intersection separates the graph into two parts that are not connected.
2:15 I guess if there's anything left on this side, um, if you if you pick some You know, here there's no boring example. Then in principle, you could you could extend this tree decomposition and it wouldn't be wrong to say here have um add another bag. Uh, can we start with this and add another bag which contains maybe just the vertex nine. This is still a valid tree decomposition. It's one um that that is larger than it needs to be. It's a valid one, so I should still be able to say, ah, this separates the graph. The the notion of separation here is a bit um uh this a part of the graph to the right of the cut or I mean the yellow part here is cut off, but it contains no other vertices than nine, so this cut is a bit trivial. If you need to allow this in general. But uh any kind of interesting edge you pick in the tree decomposition defines the intersection of two bags and then uh this intersection separates the graph into two disconnected components.
3:22 We allow that one of them is empty. That's where we've been. Now um there's a couple of things left open. Number one, why do we care? How do we turn this into an algorithm for our independent set problem? We'll come back to that last. Uh the second point, maybe first um so far I've puzzled together manually these tree decompositions and you may wonder where they come from. Yeah, so that's um also missing that we'll look at first.
3:59 The easiest way to construct tree decompositions is via elimination orderings. Yet another term, I'll show it in in life in a second. But the idea is rather simple. Uh, you choose a an order for the vertices and then delete one vertex after the other in this predefined order. So far, so good. Now there's a rule that whenever you delete a vertex, say you delete this vertex V here, then afterwards its neighborhood is completed to be a click. Maybe it was before connected, maybe not, but afterwards it needs to be. And that's that's the rule that we insist on on applying. And then um an elimination ordering is good if the maximum degree of a vertex that we click, that we eliminate is smallest. And of course, if you pick some some vertex early that introduces a lot of these edges, likely you're going to have a high degree vertex in the end that you have to eliminate and then that drives up the width of your of your ordering.
5:09 Um, let's see that in action. And so let me try to make this a bit bigger again. Focus for now on on the left and not so much um on on the tree decomposition that arises from this. Uh, well, let me let me show how the tree decomposition works. Um, uh-huh. I have to fix my slides first.
5:43 The tree decomposition you get is whenever you click a vertex, that vertex and its entire neighborhood becomes a bag. So I could start with something less clever like this one.
5:57 That already makes a relatively large bag. So maybe this wasn't the smartest start, but you could. Then I could click on this one. I'll take its current neighborhood. And you see how these these yellow edges, these are the ones that we introduced to complete the clicks. And so in in principle I can click in any order through the vertices.
6:19 Um the the bags that are formed are always the neighborhood of the vertex I clicked. And the way they are joined up into a tree is by the the following rule. Um whenever you create a new a new uh bag, it becomes the parent. It's a bit hard to see. The arrow goes to this thing. The new inserted bag becomes the root of a of a subtree. And it picks as um every element picks this this thing as a root if it's the contains the the the last occurrence of uh a vertex in its bag that was eliminated. So uh the first the first neighbor that was not eliminated yet in this bag was so far uh the one. And so it's attached to this bag because it's the first neighbor that wasn't eliminated yet that is now eliminated. If I now add the two, uh it moves onto this one because here again this contains the two.
7:28 And it attaches to this. I mean I'm I'm not reshaping the tree. I'm only attaching roots of existing trees. Let's continue this one. This is of course not a particularly good decomposition because we started with a fairly uh large degree initially. So we could try again. And maybe you have an idea of what else to pick. Uh we seem to pay almost nothing for small degree vertices. So that sounds like a a good choice. Now which node shall we pick next?
8:17 >> There's two things to keep in mind. The immediate cost is the degree of this vertex that we click now. So we want I think we know this what it says up here also. The tree width is supposed to be two. So we don't want to create bags of size larger than three. Yep. Eight sounds good. Then it will connect these two, right? But that's not too bad. These still have degree two only. So as long as I'm only clicking on degree two vertices that don't connect many other things, I'm I'm probably fine. This one as well, it only adds this one extra edge. So here it seems we can just plug through like this.
9:00 And then we get essentially an optimal Again, for this graph even you can get a path, but that's not always the case. Now in in general, what we've done here is is a good heuristic. Unfortunately, this doesn't always work.
10:06 So what you can show is this is the same as tree width as we had it before. If you pick a specific order, then by using the construction that is also implemented there, picking the back of this um the neighborhood of the vertex when it's eliminated and um connecting the tree the way we did, you can ensure that the three properties always hold. And it turns out you can always find an optimal tree decomposition that way. Uh you can also get go the other way around. If you have a fixed tree decomposition given, if you always remove a vertex that occurs only in some leaf bag, then you get an elimination ordering. And because you always pick a vertex from the bag, all the edges that this vertex may have need to be in this bag because it's only occurring there. That's a rather simple um equivalence once you view it from the right angle.
11:01 And it's a good heuristic to pick minimum degree vertex or one that generates few extra edges. Uh now in general, this won't always work to find the optimal tree decomposition.
11:18 Um let me show you a last equivalent thing just very briefly. I think it's so cute. Um it turns out there's uh Uh it turns out there's another equivalent way to define treewidth in terms of this game. Uh you have K cops, K + 1 cops if you're trying to show a treewidth K. These are the blue guys. Um they can jump from a vertex to another. In each round, one cop moves to another vertex. And there's a robber that sees everything and can whiz along any connected path, but it has to follow a path. Uh the question is can the cops circle in the robber and catch it by landing on its spot. So the the way to to think about it is that the cops have helicopters. So each one is a little helicopter and can jump anywhere else. But the robber can escape through a path of any distance.
12:30 Let's see how this works in in our example graph. So again, let's maybe try this this large thing here instead of the same old graph all over again.
12:47 So we have to place the cops initially and we can of course initially place them anywhere. So here is our robber. So now we have our five cops in the game. Now the robber will in this case always try to just maximize the distance if it has a chance. This is not a bad idea. Now how how should we move? If I take any any of the cops here and move it somewhere closer, I'm always leaving a path open for the robber to escape. So what should I do? Well, I should separate the graph, right? I should try to always stay in a separator which maybe you recognize is not so different from edges of bags and so on. So I can use k cops to separate my graph and have one cop free that I can move. In this case, this one is not needed to separate the graph. I'm still cutting off the robber, but I can slowly edge my my way inwards. And now I wish I picked different starting position because it takes gazillion clicks.
14:03 But you see how there's no way he is going to escape. The interesting part here is not that this works. Sorry. But rather Um, I can also decide to jump and you jump here. Jump and now he's crushed. Um, of course this works this way. Uh, the interesting fact is that it's equivalent to having tree width. And again this this proof I don't want to go into it it leads us a bit too far. Um, the theorem is is you have twin width at most K if and only if K plus one cops have a winning strategy. Uh, the usefulness um, I mean we've seen one direction where we essentially follow a separator and then jump. That's what we've just done. Um, whereas if the tree width is large then larger than the number of cops we have then there's always the graph is not separated. This this part this part I think is not trivial. Uh, the usefulness of this um, equivalence is mostly for proving that a graph has large twin width because that's otherwise a hard thing to do. You would have to show that no tree decomposition whatsoever succeeds.
15:18 And that seems seems hard to argue. Whereas here you can you can give a winning strategy for the robber and that then with this theorem proves that you have a certain high tree width. Okay. This one um, I'll almost say I'll label this as just a side note. I didn't give the the details anyways. Uh, but it's a acute equivalence and uh, you you'll see this sometimes also as a definition for for tree width.
15:51 Before we go to the algorithm let's go through a few basic properties that it implies for the graphs. Um, and have some examples. We've seen trees already and I think I've stepped through that you can walk along the graph in some traversal and make one back per edge and that just works out.
16:09 Um, cycles are almost as easy. Um, interestingly you take two adjacent vertices and keep one other vertex fixed and then you can walk your way along the cycle. So they have tree with two. And we've also seen this uh wide grid where the shorter uh shorter dimension essentially the any any column you cut out separates the graph. So one extra is enough to make the bags big enough to walk through. Again, think about the cops and robbers here, right? This uh you have three cops in a line closing off the graph and you have one to hop over so that you can move and not just separate statically.
16:52 Okay. That's a few graphs with small tree width. Um there's a few others known um I don't think we need that necessarily. And conversely, there's some graphs known of large tree width where it's known that you can cannot find a small tree small width decomposition. Uh the complete graph is an obvious one. And this one is maybe worth thinking for a tiny bit. Why can you never take say all the vertices except one in a bag? Where eventually you have to put some uh you have to have a bag for all of these edges, right? Every edge at the end of the day needs to be in one of the bags. And you have to have this for each of these edges. Now, of course, um if there's another bag that contains all five vertices, the whole game is pointless. Uh the question here should be can I do it so that I leave out one vertex from the bags?
17:52 Um but either way you try to do this um means that you're you're cutting off some component of a vertex that uh it needs to be in too many places to have all its edges covered. Uh intuitively the the density of the density of the connection forces you to have a decomposition that's not of this nice tree shape. Uh the other example where we've seen is the grid. I guess you can a more rigorous proof would now be by contraposition with all that we know about separators and so on, but okay. Um the grid we've already seen if you take the smaller component that dimension that's essentially the tree width. So if you have a grid of equal size then tree width can be a square root n if n is the number of vertices in the entire graph. And that turns out to be the the hard case or the the worst case for planar graphs in general.
18:55 Planar graphs always have uh tree width at most uh square root n or order square root n. And this is the the tight example. On the other hand, if you pick a somewhat random graph, even if it's not as dense as the clique, it tends to have uh higher tree width.
19:18 If the tree width is large, this means the separators every small separator is unbalanced. Okay, this um is is not not obvious. Uh let's let's ignore this. Um uh this is also just stated as a kind of side remark. I mentioned this in informally that for planar graphs essentially the obstacle to having small tree width is is the grid. And you can you can make this even more precise by saying anything that has a large tree width has to have some uh large grid as a minor graph. Minor again is you can delete vertices, you can delete edges, and you can contract vertices along an edge. [snorts] Um generalizing the observation from before, um if we have a a graph that has a a clique of size omega, this is the the clique number.
20:24 So um the largest clique in graph G has size omega. Then that is a lower bound for its tree width because not even this graph in isolation can have a smaller tree tree decomposition.
20:42 And tree width is somewhat stable under taking subgraphs in various senses. For example, induced subgraphs or minors. And induced if it's closed under induced subgraphs if it's induced closed undertaking minors it also takes closed undertaking induced subgraphs. Because if you have graph G with some edges a minor again means you could take you could fuse this into one vertex. Maybe take this and this and I'm going to leave [clears throat] leave these edges in. So the induced graph this is a not a simple graph. That's a bit bad. Let's just make this as an example. So the induced graph is just this length two path.
21:44 If if a graph has a minor H then the tree width of the minor tree width of the minor is at most the tree width of the entire graph. And the reason is that you can simulate going from G to H. These steps that I took here were getting rid of that vertex getting rid of that edge, rid of that edge, rid of that edge and contracting these. [snorts] And I can simulate all these operations in the tree decomposition and it doesn't increase the width. Specifically if I delete a vertex or an edge then you remove that vertex from all bags. Width only goes down and I'm I'm not introducing any new constraints. If you delete an edge, it doesn't even matter. You the same tree with tree decomposition is still valid. And contracting two vertices into a new vertex X means that you uh you just rename those. And uh because they were satisfied for U and V separately before, um they now still satisfy the same property for X.
22:51 Um, crucially here because contracting is only allowed for connected vertices. So that means there is a bag where U and V are joined, where occurring together in the bag, so that these connected components for U and V are also connected.
23:15 Uh, last let's tie tree with back to something we've seen before. Um, is is sparse but is more than that. If a graph has tree width W at most, then it always has a a degree W vertex or at most W. Now taken together, even before we think about why this is true, taken together with this statement, which again this is also implying if H is an induced subgraph of G, Because it's a special case of this reduction. So if that statement is true, any tree with W graph has a vertex of degree at most W. What happens if I delete that vertex with maximal degree W? Well, I'm taking an induced subgraph, right? Normally namely the induced subgraph the subgraph induced by taking all vertices but this uh maximal degree vertex. Um sorry, minimal degree vertex.
24:37 The remainder is a induced subgraph. So it's a induced subgraph of the original of the original graph. So it has at most the same tree width. So the induced subgraph will again have a vertex of degree at most W. So I can again peel that one off. We've seen that before. Maybe that rings a bell.
24:59 Uh we call that W degeneracy. And we've talked about that in the context of planar independent set where we where we found that every planar graph is is five degenerate.
25:11 And here you see uh I don't know coming from a for a different reason we have this degeneracy, but it's the same property. So of course you could imply this apply the same construction from back then um for solving independent set with the usual parameter on these if if W is bounded by a constant. Okay. Um that's an aside. Uh why is that the case? Why do we always have a a degree at most W vertex?
25:47 Well we take a tree decomposition of that width that exists by tree width. And so um we find a bag that is not contained uh we can make a a slightly uh rigid form of the tree decomposition where no bag is is strictly contained in the neighboring bag. Otherwise we don't really need it. We'll go the other way round in a in a bit. Now uh in such a tree decomposition if you take any leaf of um the tree decomposition it's a tree. It's got to have some leaves. Uh that leaf has a single neighbor T prime. And these will um have some overlap. So if if no bag is strictly contained in the other, there will be some vertex that is only in this leaf bag but not in its neighbor. And so this vertex will be one like this. So all its neighbors can only be in its bag because it doesn't occur anywhere else in the tree decomposition and all the edges incident on a vertex need to be in some bag.
27:03 And so it has vertex this vertex V has degree at most the size of its bag minus itself.