• No results found

Interpolation Treewidth of Graphs and Algorithmic Implications

N/A
N/A
Protected

Academic year: 2021

Share "Interpolation Treewidth of Graphs and Algorithmic Implications"

Copied!
26
0
0

Loading.... (view fulltext now)

Full text

(1)

U.U.D.M. Project Report 2020:51

Examensarbete i matematik, 15 hp

Handledare: Vera Koponen

Examinator: Martin Herschend

December 2020

Department of Mathematics

Interpolation Treewidth of Graphs and

Algorithmic Implications

(2)
(3)

Abstract

(4)

Contents

1 Introduction 4

2 Prerequisites and Notation 5

2.1 Graph Theory . . . 5 2.2 Computer Science . . . 6 2.2.1 NP . . . 6 2.2.2 Dynamic Programming . . . 6 2.2.3 Postorder . . . 7 2.2.4 Big O Notation . . . 7

3 Tree Decompositions and Treewidth 8 3.1 Definitions and Properties . . . 8

3.1.1 Tree Decompositions . . . 8

3.1.2 Treewidth . . . 10

3.1.3 Non-redundant Tree Decompositions . . . 11

3.2 Algorithms . . . 12

3.2.1 Treewidth and Tree Decomposition Heuristics . . . 12

3.2.2 Preliminaries . . . 12

3.2.3 Algorithms . . . 17

4 Examples 20 4.1 Maximum Weight Independent Set . . . 20

4.1.1 Problem Description . . . 21

4.1.2 Solution Idea . . . 21

4.1.3 Algorithm . . . 21

4.2 Frequency Assignment Problem . . . 23

4.2.1 Problem description . . . 23

4.2.2 Solution Idea . . . 23

(5)

1

Introduction

In 2004, mathematicians Paul D. Seymour and Neil Robertson, after 22 years of work, finished a series of 20 articles spanning over 500 pages. The end result of this impressive work was the proof of the Graph Minor Theorem, which is one of the biggest accomplishments in graph theory [2].

In this thesis however, the focus is not on this theorem, but rather on two concepts used in its proof - tree decompositions and their accompanying measure treewidth.

Informally, tree decompositions give us a way of casting graphs in the shape of a tree. This is done by letting (overlapping) subsets of the vertices (following certain rules) act as nodes in a tree - a tree decomposition of the graph. The width of a tree decomposition then measures how much the original graph had to be twisted in order to become tree-like, and the treewidth of a graph is the lowest width of any tree decomposition for said graph (trees themselves have treewidth one).

These concepts enable us to take advantage of certain algorithmic benefits of trees for any graph, with a cost measured by the width of the decomposition. Many problems that are intractable in the general case becomes much easier to solve when the problem at hand has low treewidth (and we are able to find a tree decomposition of that width). Some graph problems that are known to be in the complexity class NP have linear time algorithms if we assume that the input graphs have a bounded treewidth. This makes tree decompositions a valuable tool in fields such as combinatorial optimization, where solving hard problems as quickly as possible is often of highest priority.

(6)

2

Prerequisites and Notation

2.1

Graph Theory

We begin with reviewing some basic graph theoretic concepts that we will need later.

For the sake of completeness, we start of with defining an undirected graph:

Definition 1. A undirected graph is an ordered pair (V, E), where V is a set of vertices and E is a set of unordered pairs of vertices from V called edges. Two vertices u, v are said to be adjacent if (u, v) ∈ E.

Following are some of the most common attributes of graphs and their ver-tices:

Definition 2. Let G = (V, E) be an undirected graph and S ⊂ V be a subset of the vertices. The induced subgraph G[S] is the graph consisting of the vertices in S together with all edges in G with both ends in S, that is G[S] = (S, {(u, v) ∈ E | u, v ∈ S}).

Definition 3. A connected component of a graph G = (V, E) is an induced subgraph G[S] with vertex set S, such that there is a path between all pairs u, v of vertices in S and there is no edge (v, w) with v in S and w in V \ S. If S = V , G is called connected.

Definition 4. A graph G = (V, E) is said to be complete if all pairs of different vertices are adjacent to each other.

Definition 5. A clique of a graph G = (V, E) is a complete subgraph of G.

Definition 6. Let e = (u, v) be an edge of a graph G = (V, E). The graph obtained by contracting e is G0 = ((V \ {u, v}) ∪ {w}, (E ∪ {(w, t) | ∃(t, u) ∈

E ∨ (t, v) ∈ E}) \ {(x, y) | x ∈ e ∨ y ∈ e}), where w is a new vertex (not in V ).

Definition 7. Let G = (V, E) be an undirected graph. The vertex degree of a vertex v ∈ V , denoted |v| is the number of vertices adjacent to v.

Next we look at a way of describing moving around in a graph:

Definition 8. A path in a graph G = (V, E) is a sequence (v0, v1, . . . , vn) such

that (vi, vi+1) ∈ E for all i ∈ {0, 1, . . . , n − 1}. A simple path is a path where

all the vi are unique.

And now a special type of path whose non-existence will be important to us:

Definition 9. A cycle in a graph G = (V, E) is a path (v0, v1, . . . , vn) such that

v0= vn. A simple cycle is a cycle in which no vertices except the starting vertex

are visited more than once.

(7)

Definition 10. A tree is a connected undirected graph which contains no cycles, or, alternatively, a connected undirected graph such that every pair of vertices can be connected with an unique simple path.

There are several other equivalent definitions of trees, but these are the ones that will be of use for us.

2.2

Computer Science

In this section we, very briefly, cover some concepts from computer science of importance to us when we look at examples of how to use tree decomposition to solve some difficult combinatorial optimization problems. We will not define any concepts in this section rigorously as they will only be used in the examples. For more in depth explanations and definitions we refer to [7].

2.2.1 NP

NP is a space of problems that are, in a sense, difficult to solve. A problem can be said to be in NP if a solution of an instance to the (decision version of a) problem can be checked in polynomial time. That is, given a possible solution and an instance of the problem, there exists an algorithm that in polynomial time tells us whether this is an actual solution or not (actually it is enough that the algorithm verifies that there is a solution, it does not necessarily have to be the input solution. This shows that all problems that are solvable in polynomial time are in N P , as a verification algorithm can just solve the problem and ignore the inputted solution). A problem A is said to be NP-complete if it is in N P and is at least as hard as all the other problems in N P , in the sense that all other problems in N P have a polynomial time algorithm that translates them to A.

2.2.2 Dynamic Programming

In short, a dynamic programming algorithm is an algorithm that solves a prob-lem by combining solutions from overlapping subprobprob-lems in a way that does not solve the same subproblem more than once. Note that not all problems can be solved this way.

As a simple example, consider the Towers of Hanoi problem with n discs. One could design a dynamic programming algorithm returning the minimal number of steps required for solving this problem by solving for n − 1 discs first, and multiply that number of steps by two and then adding one. This would correspond to moving all but the largest disc to a new peg, moving the largest disc to the other unused peg and then moving all the other discs onto the largest disc again. This could be clarified in a recursion relation as follows:

Steps(n) = (

1 if n = 1,

(8)

2.2.3 Postorder

Exploring a rooted tree in postorder means that we (recursively) explore all the children of a vertex before exploring the vertex itself, starting with the root vertex. This process can be explained by the following pseudocode, ordering the vertices in the order they are explored (upon calling

P ost − Order(rooted tree T, vertex r, index 0, ordering π) for root r).

Algorithm 1: Post-Order(rooted tree T, vertex v, index i, ordering π) Result: A post order of the vertices of T

for each child c of v do

Post-Order(tree T, vertex c, index i, permutation π); end

i ← i + 1; πi← c;

return π

2.2.4 Big O Notation

(9)

3

Tree Decompositions and Treewidth

In this chapter we will introduce the concepts of tree decompositions and treewidths of graphs. Intuitively, one can think of the treewidth of a graph as a measure of how ”tree-like” the graph is, and a tree decomposition as an representation of the graph that shares some properties of trees. We will also discuss the determi-nation of the treewidth of a graph and the construction of tree decompositions with width hopefully close to the treewidth, using a heuristic method. (Sources used: [7], [3])

3.1

Definitions and Properties

3.1.1 Tree Decompositions

We start by defining tree decompositions:

Definition 11. A tree decomposition of a graph G = (V, E) is an ordered pair (T, {Vt}), where T is a tree and {Vt} consists of one subset of V for each vertex

t in T , such that:

1. Each vertex v of G belongs to at least one Vt.

2. For each edge (u, v) of G, there is at least one Vtthat contains both u and

v.

3. If x, y and z are three vertices of T and y lies on the (unique) path in T from x to z, then v ∈ Vx and v ∈ Vz implies v ∈ Vy.

The third property can be restated as the requirement that for all v ∈ V , the set Iv = {i ∈ I|v ∈ Xi}, the subtree induced by all the elements of {Vt}

containing a shared vertex, forms a connected subtree of T . The sets Vtare often

referred to as the bags of the tree decomposition, and for the sake of readability we will often use this term as well. More conversationally, we can view a tree decomposition (of a connected graph) as putting vertices of a graph into bags according to the rules above, and then the the bags form the vertices of the tree T - i.e. when then bags of vertices are viewed as single vertices, G is a tree, with a subset of the intersections of the groups as its edges. Note that in all interesting cases, some vertices will belong to several bags, as otherwise the tree decomposition would have to be a singleton tree with a single group containing all the vertices.

(10)

Definition 12. If T0 is a subgraph of T and G is a graph, then GT0 is the

subgraph of G induced by the union of all the bags of the vertices of T0, ∪t∈T0Vt.

Theorem 1. If X and Y are the two connected components of T0= (UT, VT \

{(x, y)}, then

G \ (Vx∩ Vy) = (GX\ Vx∩ Vy) ∪ (GY \ Vx∩ Vy),

where GX\ Vx∩ Vy and GY \ Vx∩ Vy have no common vertices and no edge

between them.

This says exactly that deleting an edge from T induces two connected com-ponents in the tree decomposition of G, or intuitively that the analog for a graph of deleting an edge in a tree is to delete the intersection of two bags in one of its tree decompositions.

Proof. First we prove that GX \ Vx∩ Vy and GY \ Vx∩ Vy have no common

vertices. If they had, then such a vertex, call it g1, has to be in both GX and

GY, meaning it is in the bag of at least one vertex in both X and Y , call them

t1 and t2 respectively. Now the third property of Definition 11 gives us that g1

has to be in both Vx and Vy, as it has to be in the bags of all the vertices in

the path between t1 and t2 in T , and that path has to include the edge (x, y).

Since g1is in both Vxand Vy, it is in neither in GX\ Vx∩ Vy nor GY \ Vx∩ Vy,

and we have a contradiction.

To show that there is no edge between a vertex g2 in GX \ Vx∩ Vy and a

vertex g3in GY \ Vx∩ Vy we start by noting that by property two of Definition

11 we have that if there would be, then there is a Vt3 containing both g2 and

g3. Now, t3 has to be in either X or Y , and without loss of generality we can

assume that it is in X (if it instead is in Y , then the following argument can be made with g2and X instead). Since g3is in GY it also is in Vt4 where t4is in Y .

The third property of Definition 11 again tells us that g3 then belongs to both

Vx and Vy, and therefore not in GY \ Vx∩ Vy, giving us a contradiction. 

The next theorem states that removing a vertex from T induces n connected components in G, where n is the degree of the removed vertex in T .

Theorem 2. The subgraphs

GT1\ Vt, GT2\ Vt, . . . , GTn\ Vt,

where the Ti are the connected components of T \ {t}, shares no vertices and

have no edges between them.

Proof. The proof is very similar to the proof of theorem 1. To show that there is no vertex g1that is in more than one of the subgraphs, say GTi\ Vtand GTj\ Vt

we note that if there were, then g1would have to be in Vt1 for some t1in Tiand

in Vt2 for some t2 in Tj. As the path from t1 to t2 has to include the deleted

vertex t, we have by the third property of Definition 11 that g1 also is in Vt,

(11)

Next, we see that if there were an edge between a vertex g2 in GTi\ Vt and a

vertex g3in GTj\ Vt, then by the second property of Definition 11 we have that

there would have to exist a Vt3 that contains g2 and g3, with t3 in either Ti or

Tj. Again, we can assume that it is in Ti. Since g3is in GTj it also must be in

Vt4 for some t4 in Tj. The third property of Definition 11, our constant savior,

once again swoops in and saves the day by saying that g3 has to be in Vt, and

therefore is not in GTj \ Vt, once again leading to a contradiction. 

These theorems shows, in some sense, that tree decompositions is the right way to force graphs to take on a more tree-like appearance. In the next section we will look at a measure of how much like a tree a given graph is.

3.1.2 Treewidth

Now that we have defined tree decompositions, treewidth is easily defined:

Definition 13. The width of a tree decomposition is max

t∈T|Vt|−1. The treewidth

of a graph G is the minimum width over all tree decompositions of G.

Another way to look at the definition is that treewidth is a measure of how many vertices we have to put in each bag in order for G to become a tree, or, how different from a tree is our graph? The subtraction in the above definition is there so that trees will have a natural treewidth:

Lemma 1. If H is a subgraph of G, then H has treewidth less than or equal to the treewidth of G.

Proof. Consider the tree decomposition of H that is constructed by using the same tree T as in the tree decomposition of G, and setting VH,t= VG,t∩VH. This

tree decomposition (if it indeed is one) has the desired bound on the treewidth. Now we show that it is a tree decomposition. Properties 1 and 2 of Definition 11 trivially hold.

As for property 3, as the tree T is the same, a path must pass through the same bags (possibly with fewer vertices in them), and if the bags of the starting point and endpoint of such a path contains a node v, then v is clearly in VH, so

that it will not have been removed from the bags associated with the interior vertices of the path, which must originally have contained v, as property 3 holds

for G. 

Theorem 3. A connected graph has treewidth 1 if and only if it is a tree.

Proof. To show that a tree has treewidth 1, we show how to construct such a tree decomposition from a tree. Let G be a tree. Create a bag for each vertex of G, and a bag for each edge of G, containing the end points of that edge. These bags clearly have no more than two vertices in them. Now let T consist of a vertex for each bag, with edges between two vertices t1and t2if t1 is associated

with an vertex v in G, t2 is associated with an edge e in G, and v ∈ e. This

(12)

has property 3, note that the only paths in T of length 3 (by construction, no longer paths can exist) with a common vertex v in the bags of the starting vertex and the end vertex, is a path from a vertex associated with an edge in G with v as an end to a vertex associated with v to a vertex associated with another edge in G with v as an end, and for this path the third property of Definition 11 definitely holds.

Now we show that all graphs with treewidth 1 are trees by assuming this is not true and showing that this leads to a contradiction. So, assume G is a connected graph with treewidth 1 that is not a tree. Then G contains a subgraph C that is a cycle. Now, by lemma 1 it is enough to show that C can not have treewidth 1. The tree decomposition of C has to have a bag for each edge in C, containing both its ends. Choose two such bags. In the path between the two vertices in T associated with those bags there must be an edge between two vertices whose bags are not equal (as the bags of the starting vertex and the end vertex are different). Since, by Lemma 1, C has treewidth 1 (and therefore every bag has cardinality less than or equal to two), these two bags can share at most one element. Now Theorem 1 gives us that removing the intersection of these two bags from C separates it into two subgraphs, which are nonempty since one of them contains at least one element from the bag of the starting vertex and the other contains at least one element from the bag of the ending vertex of the path in T . Thus we have disconnected a cycle into two nonempty subgraphs by removing (at most) a single vertex, which is impossible, giving us

our contradiction. 

3.1.3 Non-redundant Tree Decompositions This section is based on [7].

Since there is nothing in the definition of tree decompositions that gives us control over the number of bags of a decomposition (as an example, we can for any tree decomposition choose any bag and any vertex in that bag, and add a a path, of any length, consisting of bags with only that vertex in it), we will introduce a concept that guarantees that we can, given any tree decomposition of a graph of degree n, construct a tree decomposition with at most n bags. Definition 14. A tree decomposition (T = (I, F ), {Xi|i ∈ I}) such that there

is no edge (u, v) ∈ F with Xu⊂ Xv is called non-redundant.

Note that we can turn any tree decomposition into an non-redundant tree decomposition by repeatedly iterating over the edges and contracting any edge (u, v) where Xu ⊂ Xv, until no such edges remain. This gives us exactly the

control we are looking for:

Theorem 4. A non-redundant tree decomposition of a graph of degree n has at most n bags.

(13)

tree decomposition (T = (I, F ), {Xi|i ∈ I}) of G, choose a leaf t of T . Since

the tree decomposition is non-redundant, there must be at least one vertex v in Xt not in the bag of its neighbour, and, by the third property of tree

decompositions, not in any other bag of the tree decomposition either. Let U be the set of all such vertices in t. If we now remove t from T , we have a non-redundant tree decomposition of G \ U , which by our assumption has no more than n − |U | ≤ n − 1 bags, which gives us that our original tree decomposition

has at most n bags. 

3.2

Algorithms

Most proofs in this section follows [4] or [5].

3.2.1 Treewidth and Tree Decomposition Heuristics

Finding the exact treewidth of a graph, and therefore also a tree decomposition with minimal width, is NP-complete [7]. There are exact algorithms that, given enough time, returns the treewidth of a graph [1], in fact, using results later in this section, we will be able to see that constructing a tree decomposition out of every possible permutation of the order of the vertices of a graph and measuring its width does the job, although very inefficiently. In practice however, it is often better to use heuristic algorithms that gives upper bounds to the treewidth (and tree decompositions with that width), as it is often too time consuming to compute the exact treewidth. One popular heuristic algorithm that is fast and often gives a good upper bound on the treewidth is based on a relation between treewidth and triangulations of graphs [5].

3.2.2 Preliminaries

We start with some theory necessary for the algorithm. First we go over some some graph theoretic concepts that are a bit more specialized than the ones listed before. Then we prove some properties of these concepts.

Definition 15. A graph G is triangulated if every cycle in G with length at least four has a chord, that is, an edge between two non-consecutive vertices.

A triangulated graph is also called chordal. Later on we will show how to construct a triangulated graph from any given graph, and the following defini-tion will be useful.

Definition 16. A graph H is a triangulation of G if H is triangulated and can be obtained from G by adding zero or more edges. H is a minimal triangulation of G if there is no proper subgraph of H that is a triangulation of G.

(14)

Definition 17. An elimination order of a graph G is a bijection π : V → {1, 2, . . . , n}. An elimination order π is perfect if, for all v in V , the set of higher order neighbours {w|(v, w) ∈ E ∧ π(w) > π(v)} form a clique.

So, an elimination order is simply an ordering (or permutation) of the ver-tices of a graph, but a perfect elimination order has some requirements. Note that the definition of a perfect elimination order also means that a vertex to-gether with its higher ordered neighbours form a clique.

Example 1. Every ordering of the vertices of a complete graph is a perfect elimination order (since all vertices are connected).

Now we will define some concepts that will be useful in our proofs:

Definition 18. A graph G = (V, E) is the intersection graph of subtrees of a tree, if and only if there is a tree T = (I, F ), and for each v ∈ V a subtree of T , Tv = (Iv, Fv), such that for all v, w ∈ V, v 6= w, we have that {v, w} ∈ E if

and only if Tv and Tw have at least one vertex in common, i.e., Iv∩ Iw6= ∅.

Definition 19. A vertex v of a graph G is called simplicial if its neighbours form a clique in G.

Definition 20. A vertex separator for two non-adjacent vertices u and v in a graph G = (V, E) (also called an u − v-separator) is a subset S of V such that u and v are in separate connected components in G[V \ S]. If no proper subset of S is a vertex separator for u and v, then S is called a minimal vertex separator.

Definition 21. The fill-in graph of a graph G with respect to an elimination order π is defined as the graph obtained by adding the minimal amount of edges to G necessary to make π a perfect elimination order.

Example 2. Consider the graph G = ({a, b, c, d}, {(a, b), (a, c), (b, d)}) and the elimination order π = (a, b, c, d). To obtain the fill in graph of G with respect to π we can add just one edge to G, namely (b, c), as the vertex a is the only vertex with more than one neighbour with higher order in π.

To construct a fill-in graph given a graph G and an elimination order π, one can simply go through the vertices in the order prescribed by π and add edges between all neighbours of any given vertex v with higher index in π than v, as we will see later when we look at algorithms.

Now that we have made it through some definitions, we head straight into a healthy meal of lemmas:

Lemma 2. If a graph G is triangulated, then every minimal vertex separator induces a complete subgraph of G.

(15)

(x, a1, a2, . . . , as, y, b1, b2, . . . , bt, x) containing at least one vertex ai∈ A and at

least one vertex bj ∈ B, that is of minimal length. This cycle has length at

least four and so has to have a chord. But since S is a vertex separator, no ai

has a bj as neighbour, and since we constructed the cycle to be minimal, no ai

has an aj of the cycle as neighbour, and the same for vertices bi and bj. That

means that the only possible chord is (x, y) and all pairs of vertices in S are

connected. 

Lemma 3. Let G = (V, E) be a graph and (T = (I, F ), {Xi|i ∈ I}) be a tree

decomposition of G. If W ⊂ V is a clique in G, then there is an i ∈ I such that W ⊂ Xi.

Proof. Let W be a clique in G of size greater than two (as otherwise this is trivially true by the second property of the definition of tree decompositions). We assume that the n first vertices (of any ordering of the vertices of W ) are contained in some bag together, and show that there has to be a bag containing the n first vertices and also the n + 1:th vertex (which we will call v). Let X1

be a bag containing the n first vertices of W . v has n edges to vertices in that bag (since W is a clique), which by the second property of tree decompositions means that there must exist bags containing v and each of the n vertices, of which none is X1(as otherwise we would be done).

The subtree induced by v (alternative version of third property) must con-nect to X1 (or one such bag, without loss of generality we let X1 be this bag)

as it includes all vertices in X1∩ W . The connecting vertex must contain all

vertices in X1∩ W , otherwise vertices would be lost (by the third property).

Hence the connecting vertex is as requested.

As a basis for our induction we can use the second property of the definition of tree decompositions, which gives us a guarantee that every two vertices of a clique must be in at least one bag together.  Lemma 4. Every triangulated graph G has a simplicial vertex, and if G is not complete, then it has two simplicial vertices that are non-adjacent.

Proof. We assume G is not complete, as otherwise the lemma is obviously true, and we also assume that the lemma holds for all graphs with less vertices than G. Now, G has two non-adjacent vertices a and b. Let S be a minimal vertex separator for u and v and let G[A] and G[B] be the connected components of G[V \ S] that contains a and b respectively. By our inductive hypothesis either G[A∪S] has two non-adjacent simplicial vertices, of which one has to be in G[A] by the above lemma (as S induces a complete subgraph of G), or G[A ∪ S] is complete and all vertices in A ∪ S are simplicial. Since S is a separating set, any vertex in A that is simplicial in G[A ∪ S] is simplicial in G. As the basis for our induction we can look at the triangulated graphs with |V | = 2. We can without loss of generality look only at the connected graphs, so that every vertex has exactly one neighbour, forming a clique of size one. Now we know that there is at least one simplicial vertex in A, and by the same argument this is also true

(16)

Simplicial vertices are useful, as if we have a simplicial vertex v of a triangu-lated graph G, G[V \ v] is also triangutriangu-lated, as its neighbours form a clique and therefore no chord is removed. This gives us a characterization of triangulated graphs, and a link to tree decompositions, that we will use in our algorithms:

Theorem 5. Let G be a graph. The following statements are equivalent.

i. G is triangulated.

ii. G has a perfect elimination order.

iii. G is the intersection graph of subtrees of a tree.

iv. There is a tree decomposition (T = (I, F ), {Xi|i ∈ I}) of G, such that for

each i ∈ I, Xi is a clique in G.

Proof.

i ⇒ ii: We assume that all triangulated graphs of order less than G has a perfect elimination order. By lemma 4, if G is triangulated it has a simplicial vertex v. Now, H = G[V \ v] is also triangulated, as the neighbours form a clique and therefore no chord is removed in H, and by our inductive hypothesis H has a perfect elimination order that can be prefixed by v to create a perfect elimination order for G. As the basis for our induction we show that this is true in the case where |V | = 2. Then we can start with any vertex, and its only neighbour forms a clique of size one.

ii ⇒ i: Take any simple cycle C in G and let v be the vertex in C that has the lowest index in a perfect elimination order of G. Now, since all the neighbours of v that are in C (there are at least two of them since C is a cycle) form a clique as they have higher index than v in the perfect elimination order, C is guaranteed a chord.

iv ⇒ iii: For all v in V , let Tv be the subtree induced by the vertices of T

whose bags contain v (that this is a subtree is given by the definition of tree decompositions). G is a intersection graph of these subtrees of T .

iii ⇒ i: Given a family of subtrees {Tv}v∈V of a tree T with the property that

Tu∩Tv6= ∅ if and only if (u, v) ∈ E, and a chordless cycle (v1, v2, . . . , vk, v1) with

k > 3 that corresponds to a sequence of subtrees (T1, T2, . . . , Tk, T1) with the

property that Ti∩ Tj6= ∅ if and only if i − j ≡ 1 (mod k), we construct a simple

cycle in T (giving us a contradiction) as follows, with all the arithmetic done modulo k: For each i ∈ {1, 2, . . . , k}, Choose a vertex ai from the intersection

Ti∩ Ti+1. Then look at the unique paths from ai to ai−1(in Ti) and from ai to

ai+1(in Ti+1), and call the last common vertex of those paths bi. This gives us

that bi has to be in Ti∩ Ti+1. Finally, take the simple path from bi−1to bi and

(17)

subset of Ti, which tells us that Pi∩ Pj 6= ∅ if i − j ≡ 1 (mod k). Since we chose

bi as the last common vertex of the paths from ai to ai−1and from ai to ai+1,

we also have that Pi∩ Pi+1 = {bi}. This gives us that ∪iPi is a simple cycle.

If we allow k to be less than four, then there is nothing stopping all vertices in our construction from being the same (as all subtrees overlap), and we could just construct a path of length one, which does not give us a contradiction.

i ⇒ iv: We assume that this holds for all graphs with order less than G. Now, given a triangulated graph G, we remove a simplicial vertex v from it (whose existence is guaranteed by Lemma 4), giving us a new graph H. By our assumption, H has such a tree decomposition. To extend this into a tree decomposition for G meeting our criteria, we create a bag containing v and its neighbours in G, which is a clique since v is simplicial. We then attach this bag to some bag in the tree decomposition of H containing all the neighbours of v (there is at least one since the neighbours of v forms a clique in H). This construction trivially meets requirement one and two of Definition 11, and since it only adds a leaf to any subtree Tw that consists of all the bags of T that

contains w for all vertices w that are adjacent to v, it also meets requirement three. As a basis for our induction, we can use the case |G| = 1, when it is

trivially true. 

This theorem sets us up for the following result, which offers alternative ways to define the treewidth of a graph.

Theorem 6. Let G be a graph and k ≤ n be a positive integer. The following statements are equivalent.

i. G has treewidth at most k.

ii. G has a triangulation H in which no clique has size greater than k + 1.

iii. There is an elimination ordering π, such that the maximum size of a clique of the fill-in graph of G with respect to π is at most k + 1.

iv. There is an elimination ordering π, such that no vertex v ∈ V has more than k neighbours with a higher number according to π in the fill-in graph of G with respect to π.

Proof.

i ⇒ ii : Let (T = (I, F ), {Xi|i ∈ I}) be a tree decomposition for G, and

construct a new graph H by adding edges between all vertices of G that are in at least one bag Xi together. We can now use the same tree decomposition

(18)

ii ⇒ iii : If we take π to be a perfect elimination order of H, which is always possible by Theorem 5, then the fill-in graph is equal to H and our result follows.

iii ⇒ i : Given a fill-in graph H for G with respect to π, we have by theorem 5 that there exists a tree decomposition of H where all the bags are cliques in H, and by our assumption the max clique size is k + 1, giving this tree decomposition a width of at most k. Now, since G is a subgraph of H, Lemma 1 gives us that G has treewidth at most k.

iii ⇒ iv : This is a direct consequence, using the same ordering π, as a vertex v together with its neighbours with higher index in π form a clique in the fill-in graph.

iv ⇒ iii : Take any clique W of the fill-in graph of G with respect to π, and call the vertex in W with the lowest index v. Now, as v has at most k neighbors, no clique can have size greater than k + 1.  This theorem gives us a convenient way of upper bounding the treewidth of a graph - we can simply choose any ordering of the vertices of that graph, construct a fill-in graph from that ordering, and check the maximum clique size in that fill in graph. As we will see in the next section, it is also easy to construct a tree decomposition of a graph given an elimination order.

3.2.3 Algorithms

Here we will present, and prove the correctness of, an algorithm that returns a tree decomposition of a given graph, together with algorithms necessary for it to work.

Definition 22. Let G be a graph and v a vertex of G. Eliminating v means turning the neighbours of v into a clique and removing v.

Theorem 7. Let G = (V, E) be a graph, π be an ordering of the vertices of G and H = (V, EH) be the fill-in graph of G with respect to π. Algorithm 2 below

returns, given G and V = (v1, v2, . . . , vn), where the vertices are in the order

given by π, a tree decomposition (T = (V, F ), {Xv|v ∈ V }) of G such that:

i. For all vi in V , Xvi is the union of vi and its higher numbered neighbours

in H.

ii. The width of the tree decomposition is one less than the maximum clique size in H.

(19)

tree decomposition. Property one holds by construction, as every vertex v is (at least) in the bag Xv. Property two also holds, since for every edge e = (x, y)

with π(x) < π(y), x and y is in (at least) Xx. To see why property three holds,

consider a path from the bag of vertex x to the bag of vertex y, where both bags contain a vertex z and x has higher index in π than y. Now, z must be in the bag neighbouring the bag of y, call it the bag of w, as y is a neighbour of both w (since the bag of y is connected to the bag of w, w has to be the lowest indexed neighbour of y) and z (as otherwise z would not be in the bag of y), so that they would have been connected in the iteration where y was eliminated. Now, if we replace y with w and repeat our argument, we see that also the next bag on this path must contain z, and repeating this for all the bags on the path we see that all bags on the path between the bags of x and y contain z, so that property three holds. To see that the first condition holds, we note that the algorithm recursively constructs the fill-in graph of G, as it in each iteration eliminates the first vertex in the ordering. This means that Xvi

will be as stated. For the same reason, the second condition also holds, as a clique in a fill-in (triangulated) graph with respect to π is the neighbour set of the vertex v in the clique with lowest index in π, plus v itself. 

Algorithm 2: Elimination-Order-To-Tree-Decomposition(Graph G = (V,E), Elimination Order π)

Result: (T = (V, F ), {Xv|v ∈ V }) is a tree decomposition of G.

if |V | = 1 then

return a tree decomposition with one bag Xv1= {v1}

end

Let G0 be the graph obtained by eliminating v1from G, and let π0 be

the elimination order obtained by removing the first element of π; ({Xw|w ∈ V0}, T0= (V0, F0)) =

Elimination-Order-To-Tree-Decomposition(G0, π0);

Let vj be the neighbour of v1 such that j = min{i|{v1, vi} ∈ E};

Xv1 = NG[v1];

return (T = (V, F ), {Xv|v ∈ V }), where F = F0∪ {v1, vj};

(20)

Algorithm 3: Greedy-Degree(Graph G) Result: π is an elimination order of G H=G;

for i = 1 to n do

Choose a vertex u so that deg u = minv∈VH(deg v);

π(u) ← i;

Eliminate u from H; end

return π

The algorithm below constructs a fill-in graph from an elimination order. This can be useful since only the fill-in graph is necessary to compute an upper bound on the treewidth of a tree decomposition by Theorem 6, so that it gives us a convenient way of computing an upper bound on the treewidth of a graph from any given elimination order.

Algorithm 4: Order-To-Fill-In(Graph G, Elimination Order π) Result: H is a triangulation of G

H=G;

for i = 1 to n do u = π−1(i);

for v, w in {(v, w) ∈ E|π(v) > π(u) ∧ π(w) > π(u)} do EH∪ (v, w);

end end return H

(21)

4

Examples

Up until now when we have talked about treewidth and tree decompositions, we have looked at their properties and how to find them. The focus of this section is on what we can do with these concepts, or put another way: what are they good for? Besides the theoretical uses of these concepts, which can be illustrated by the proof of the Graph Minor Theorem by Robertson and Seymour, where the concepts first arose [2], there are very concrete practical applications in the field of combinatorial optimization (optimization problems where the variable domains are finite subsets of the integers), and we will give examples of two problems here where the concepts can be successfully used to improve the complexity of solving the problem.

First we give some background: by constraint graph we mean a graph with the variables of a problem as vertices, where there is an edge between two vertices if not all combinations of their values are allowed, that is, if their allowed values depend on each other. In a Sudoku puzzle for example, we can let the empty squares of the puzzle be the variables. Since no two squares in the same row are allowed to have the same value, the variables for the squares in a row would form a clique in the contstraint graph.

Now, for some N P -hard problems the problem can be made linear in the number of variables (but exponential in the width of the tree decomposition) by the use of a dynamic algorithm on the tree decomposition of the constraint graph. The main idea is that given a valid combination of values for the vari-ables in a bag of the tree decomposition, the subproblems rooted at each of the children of that bag can be solved independently from the rest of the tree, due to the separation properties of tree decompositions. This means that a problem that seems hopeless to solve at first glance, can can be solved quite effectively if the constraint graph of the problem has low treewidth (compared to the number of vertices). So when can we hope for low treewidth of the constraint graph? Intuitively, one can think of the treewidth of a constraint graph as a measure of its locality, that is - to what degree are the vertices that are adjacent clustered together? Examples of situations where this might occur is when the problem is of a geographic nature, or problems concerning networks, where a variable is more likely to affect another if they are close to each other.

4.1

Maximum Weight Independent Set

(22)

[7], we will show that it can be solved in time linear to the number of vertices (but still exponential in the width of the tree decomposition) if we have a tree decomposition of the graph.

4.1.1 Problem Description

Given a graph G = (V, E) and a set of weights for the vertices W = {wv|v ∈ V },

find an independent set S ⊂ V such that P

v∈Swv is maximized, where an

independent set is defined as a subset of V such that no two vertices in the set are adjacent to each other.

4.1.2 Solution Idea

To see how this can be solved efficiently with dynamic programming if we have a low width tree decomposition of G, let us first consider this problem when the input graph is a tree T . Fixing a root r for T allows us to talk about children of a vertex v, that is, vertices in T that are adjacent to v and are not in the path from r to v. Now, for a vertex v that is not a leaf, the optimal solution either includes v in S (and thus none of its children) or it does not (and children of v can be included). To decide whether to include v or not, we can look at the two subproblems where v is included and not included respectively (or, put another way, which subset of {v} should be included in the optimal solution). Starting at the leaves this problem can be solved in linear time, by, for each vertex v in the tree, solving the subproblem for the tree rooted at v. This is done by saving two values for each vertex, the optimal solution if we choose to include v, and the optimal solution if we do not include v. The optimal solution for the whole problem then is the maximum of these two values for the root node.

The generalization of this idea to tree decompositions looks instead at the subproblem for each bag in the tree decomposition: Which subset of the vertices in the bag should be included in the optimal solution, or, which combination of values should the variables in that bag have in the optimal solution (where the values are the same as before)? Using the same method as for trees, this can also be done in linear time, although exponential in the width of the tree decomposition, as we will explore each combination of values for the variables of each bag.

4.1.3 Algorithm

For this algorithm to run in time linear to the number of vertices in the input graph, we need some way to build solutions (where a solution is the maximum weight of an independent set) for the subproblem on the tree decomposition induced by the subtree rooted at some vertex t, given the solutions to the subproblems of the induced graphs of each of its children. So, given a valid combination U of values for the vertices in the bag of t, what is the optimal solution SU of the subproblem for Gt, defined as the graph rooted at t?

Let StU denote the optimal solution to the subproblem Gt, given that the

(23)

of the variables in A ⊆ V that have value 1 according to U . We can compute the value StU from the values of the subproblems rooted at the children ti of t

as follows:

StU = WVt U+

X

i∈Children(t)

Sti U − W{Vt∩Vti}U

Since the function giving us the value we want to maximize (the objective function) is linear, we do not need to worry about the optimal values for the subproblems not being the same in the optimal solution for the whole problem, as we simply add up the values for the included vertices. The other thing we need to consider is whether variables in different bags can be assigned values that break a constraint, but this is exactly what the separation properties of tree decompositions (theorems 1-2) promise us will not happen.

This gives us the following algorithm.

Algorithm 5: Maximum-Weight-Independent-Set(Graph G)

Result: The maximum weight of an independent set of G Find a tree decomposition (T , {Vt}) of G;

Root T at some vertex r; for t in T (post-order) do

for each valid combination U of values for the variables in Vt do

StU = WVt U+ X c∈Children(t) max U0 ({ScU 0−W{Vt∩Vc}U : U |Vt∩Vc= U 0 |Vt∩Vc}) end end return max

U {SrU : U is a valid combination of values for the variables in Vr}

The following gives us the (worst-case) time complexity of the algorithm, not including the work to find the tree decomposition.

Let w be the width of the tree decomposition. For a vertex t of T we, for every combination of values U , add at most w + 1 values to obtain WVt U,

perform one addition and, for the d children of t, add one value to a sum, find the maximum of at most 2w+1 values and, for every combination U0 of values,

compare at most w + 1 values to see if U |Vt∩Vc = U

0|

Vt∩Vc. Since there are at

most 2w+1 combinations of values for the variables in any bag, this gives us a complexity of

O(2w+1(w + 1 + d(1 + 2w+1+ 2w+1(w + 1 + 1)))) =

O(2w+1d2w+1w) =

O(4w+1dw).

(24)

4 and that each vertex is counted as a child exactly once, we get a complexity of

O(4w+1wn)

for the entire algorithm.

4.2

Frequency Assignment Problem

This is an example of a problem with real life data where tree decompositions have been used successfully, improving the best known solution for several in-stances. This section is a brief summary of [6], which mainly covers the general solution idea. For a more detailed explanation as well as a integer programming model and further improvements, see [6]. The problem is about assigning fre-quencies to antennas such that the interference between antennas is as low as possible. Also, some antennas may have a penalty corresponding to a specific assignment. The constraint graph here has a vertex for each antenna, with an edge between two vertices if the corresponding antennas have some sort of in-terference relation, i.e. if some combination(s) of values for the two antennas have a non-zero penalty.

4.2.1 Problem description

This problem can be described by an ordered quadruple (G, D, q, p), where G = (V, E) is the constraint graph, with vertices being antennas and edges represent some interference relation between the two ends, D is the set of domains for the antennas, q is a function that gives a penalty for certain choices of frequencies for antennas and p is a function that gives the interference between two antennas based on their frequencies. Now the problem is to assign values to each v ∈ V such that the total value of p and q is minimized.

4.2.2 Solution Idea

(25)

4.2.3 Algorithm

Algorithm 6: Frequency-Assignment(Graph G, p, q)

Result: The minimum penalty assignment of values for the vertices of G Find a tree decomposition (T , {Vt}) of G;

Root T at some vertex r; for t in T (post-order) do

for each combination U of values for the variables in Vtdo

StU = WVt U+ X c∈Children(t) max U0 ({ScU 0−W{Vt∩Vc}U : U |Vt∩Vc= U 0 |Vt∩Vc}) end end return max

U {SrU : U is a combination of values for the variables in Vr}

To find the time complexity, we can perform the exact same calculation as for the previous example, but replacing 2w+1 with |D|w+1, so that the complexity

(26)

References

[1] Hans L. Boedlander et al. “On Exact Algorithms for Treewidth”. In: ACM Transactions on Algorithms 9.1 (Dec. 2012).

[2] Reinhard Diestel. Graph Theory. 2nd ed. Springer-Verlag, 200, pp. 251–282. [3] Rodney G. Downey and Michael R. Fellows. Fundamentals of

Parameter-ized Complexity. 1st ed. Springer, 2013.

[4] Martin C. Golumbic. Algorithmic Graph Theory and Perfect Graphs. 1st ed. Academic Press, 1980, pp. 83–92.

[5] Arie M.C.A. Koster and Hans Boedlander. Treewidth Computations I. Up-per Bounds. Tech. rep. Utrecht University, Department of Information and Computing Sciences, Sept. 2008.

[6] Arie M.C.A. Koster, Stan P.M. van Hoesel, and Antoon W.J. Kolen. “Op-timal Solutions for Frequency Assignment Problems via Tree Decomposi-tion”. In: Graph-Theoretic Concepts in Computer Science (Ascona, Switzer-land). June 1999.

References

Related documents

Av tabellen framgår att det behövs utförlig information om de projekt som genomförs vid instituten. Då Tillväxtanalys ska föreslå en metod som kan visa hur institutens verksamhet

Generella styrmedel kan ha varit mindre verksamma än man har trott De generella styrmedlen, till skillnad från de specifika styrmedlen, har kommit att användas i större

Närmare 90 procent av de statliga medlen (intäkter och utgifter) för näringslivets klimatomställning går till generella styrmedel, det vill säga styrmedel som påverkar

• Utbildningsnivåerna i Sveriges FA-regioner varierar kraftigt. I Stockholm har 46 procent av de sysselsatta eftergymnasial utbildning, medan samma andel i Dorotea endast

Den förbättrade tillgängligheten berör framför allt boende i områden med en mycket hög eller hög tillgänglighet till tätorter, men även antalet personer med längre än

På många små orter i gles- och landsbygder, där varken några nya apotek eller försälj- ningsställen för receptfria läkemedel har tillkommit, är nätet av

Det har inte varit möjligt att skapa en tydlig överblick över hur FoI-verksamheten på Energimyndigheten bidrar till målet, det vill säga hur målen påverkar resursprioriteringar

DIN representerar Tyskland i ISO och CEN, och har en permanent plats i ISO:s råd. Det ger dem en bra position för att påverka strategiska frågor inom den internationella