Discovering Treewidth Hans L. Bodlaender, Utrecht University.

91
Discovering Treewidth Hans L. Bodlaender, Utrecht University

Transcript of Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Page 1: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Discovering Treewidth

Hans L. Bodlaender, Utrecht University

Page 2: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek2

This talk

1. Introduction

– Definition of treewidth: a graph parameter– Applications

• Determining the treewidth of a graph:

2. Exact algorithms

3. Upper bounds

4. Lower bounds

5. Pre-processing

Theory andexperimental

results

Page 3: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek3

I. Introduction

• History: resistance, laws of Ohm, series parallel graphs

• Definition of treewidth• Applications

– Hard problems becoming easier on special graphs

– Probabilistic networks– PTAS’s on planar and other graphs

• Some useful graph theory

Page 4: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek4

Computing the Resistance With the Laws of Ohm

21

111

RRR21 RRR

R1 R2 R1

R2

1789-1854

Page 5: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek5

Repeated use of the rules

6

2

6

25

1

Has resistance 4

1/6 + 1/2 = 1/(1.5)1.5 + 1.5 + 5 = 81 + 7 = 81/8 + 1/8 = 1/4

7

Page 6: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek6

A tree structureP

6 2

6 25

17

P P

S S

5

6 62 2

7 1

Page 7: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek7

• Network is ‘series parallel graph’

• 196*, 197*: many graph problems that are hard for general graphs are easy for – Trees– Series parallel graphs

• Many well-known problems, e.g., maximum independent set, Hamiltonian circuit, …

Using tree structures for solving hard problems on graphs 1

Linear / polynomialtime computable

e.g.:NP-complete

Page 8: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek8

Birth of treewidth

• Algorithms for trees and series parallel graphs can be generalized:

• 198*: problems solvable on decomposable graphs (Bern, Lawler, Wong; Arnborg, Proskurowski; Wimer; Borie; Scheffler, Seese; Courcelle; Lautemann; … )– Arnborg and Proskurowski: Partial k-trees– Robertson and Seymour: treewidth (in their

work on graph minors)

Page 9: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek9

Tree decomposition• A tree decomposition:

– Tree with a vertex set called bag associated to every node.

– For all edges {v,w}: there is a set containing both v and w.

– For every v: the nodes that contain v form a connected subtree.

b c

d ef

a ab c c

cde

h

hf fa g g

a g

Page 10: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek10

Tree decomposition• A tree decomposition:

– Tree with a vertex set called bag associated to every node.

– For all edges {v,w}: there is a set containing both v and w.

– For every v: the nodes that contain v form a connected subtree.

b c

d ef

a ab c c

cde

h

hf fa g g

a g

Page 11: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek11

Tree decomposition• A tree decomposition:

– Tree with a vertex set called bag associated to every node.

– For all edges {v,w}: there is a set containing both v and w.

– For every v: the nodes that contain v form a connected subtree.

b c

d ef

a ab c c

cde

h

hf fa g g

a g

Page 12: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek12

Treewidth (definition)

• Width of tree decomposition:

• Treewidth of graph G: tw(G)= minimum width over all tree decompositions of G.

b c

d ef

a ab c c

cde

h

hf fa g g

a b cd e f

g h

ga

1||max iIi XWidth 2

Page 13: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek13

Useful lemmas

• If the treewidth is at most k, then G has a vertex of degree at most k.

– There is a vertex with all neighbours in the same bag.

• If W is a clique in G, then a tree decomposition of G has a bag i with W Xi.

– Follows from the Helly property for trees

Page 14: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek14

Fill-in

• Given a permutation of the vertices, the fill-in graph is made as follows:

– For i = 1 to n do• Add an edge between each pair of higher

numbered neighbours of the ith vertex

12

3

45

12

3

45

12

3

45

Page 15: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek15

Alternative definition

• The treewidth of a graph is the minimum over all permutations of its vertices of the maximum number of higher numbered neighbours of a vertex in the fill-in graph.

12

3

45

12

3

45

Treewidth 2

Page 16: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek16

Constructing tree decomposition for fill-in graph

• Let v be the first vertex in

• Recursively, make tree decomposition for G – v.

• The neighbours v form a clique in G – v.– There is a bag that contains

N(v)

N(v)…

i*

and then…

Page 17: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek17

N(v)v

Constructing tree decomposition for fill-in graph

• Let v be the first vertex in

• Recursively, make tree decomposition for G – v.

• The neighbours v form a clique in G – v.– There is a bag i* that

contains N(v)

• Add a new bag containing v and its neighbours, making that adjacent to i*

N(v)…

i*

Page 18: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek18

Applications of treewidth

• Graph minor theory (Robertson and Seymour)

• Many hard problems become linear time solvable when restricted to bounded treewidth

– Optimisation

– Probabilistic networks

– …

• VLSI-layouts

• Compilers

• Choleski factorisation

Page 19: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek19

Many graphs have small treewidth

• Trees (1), series parallel graphs (2), Halin graphs (3), outerplanar graphs (2), …

• Graphs from some applications • Many graphs have large treewidth: when

containing a large grid, a large clique …

Page 20: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek20

Tree decompositions contain separators

• If neither v or w belongs to X(i) then {v,w} cannot be an edge of G.

• So X(i) separates vertices appearing below i in the tree from the rest of G.

• This allows for dynamic programming algorithms

X(i)

v

w

Page 21: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek21

Dynamic programming algorithms

• Many NP-hard (and some PSPACE-hard, or #P-hard) graph problems become polynomial or linear time solvable when restricted to graphs of bounded treewidth

– Well known problems like independent set, Hamiltonian circuit, graph colouring

– Frequency assignment (Koster et al.)

Page 22: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek22

Dynamic programming with tree decompositions

• For each bag, a table is computed:– Contains information on

subgraph formed by vertices in bag and bags below it

– Bag itself separates this subgraph from rest of the graph

– Often limited information needed

• Computing a table needs only tables of children and local information

1 2

3

4

6

5

Page 23: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek23

Probabilistic networks

• Underlying decision support systems

• Representation of statistical variables and (in)dependencies by a graph

• Central problem (inference) is #P-complete

• Lauritzen-Spiegelhalter, 1988: linear time solvable when treewidth (of moralized graph) is bounded

– Treewidth appears often small for actual probabilistic networks

– Used in several modern (commercial and freeware) systems

Page 24: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek24

Page 25: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek25

Page 26: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek26

Monadic second order logic

• Courcelle: Every graph problem that can be formulated in Monadic Second Order Logic can be solved in linear time on graphs with bounded treewidth

– Language with constructions:

• Quantification over vertices, edges, sets of vertices, sets of edges (for all vertex sets W there exists an edge e, such that ...)

• Membership tests, adjacency tests ( {v,w} in E ),

• Logical operations (and, or, not, ...)

• Extended for optimisation problems (Arnborg et al, Borie et al.)

Page 27: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek27

Problems on planar graphs (1)

• Method originated by Baker (198*, 1994)

• PTAS for many problems on planar graphs, and extensions

• Extended by several authors to more general/other classes of graphs (e.g., SODA 2005: Demaine & Hajigitani – more problems and minor closed classes of graphs, van Leeuwen 2004: unit disk graphs of small density)

• Here: example: PTAS for independent set on planar graphs.

Page 28: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek28

Ingredient 1: k-outerplanar graphs

• Label vertices of a plane graph by level.

• All vertices on exterior face level 1.

• All vertices on exterior face when vertices of levels 1 … i are removed are on level i+1.

• Graph is k-outerplanar when at most k levels.

• Theorem: k-outerplanar graphs have treewidth at most 3k – 1. 3-outerplanar

Page 29: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek29

Independent set on k-outerplanar graphs

• For fixed k, finding a maximum independent set in a k-outerplanar graph can be solved in linear time (approximately 8k * n time).

– Dynamic programming using tree-decomposition

Page 30: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek30

Baker’s scheme

• For each i in {1,2, …, k} do– Remove all vertices in levels i, i+k, 2i+k, 3i+k,

…– Each connected component of the remaining

graph (and hence the remaining graph) is (k-1)-outerplanar.

– Solve independent set exactly on the remaining graph.

• Output the best of the k obtained independent sets.

Page 31: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek31

Quality

• Look at a maximum independent set S.• Each of the k runs deletes a different subset of S.• So, there is a run that deletes at most |S|/k vertices

from S: one of the runs gives an answer that is at least (k-1)/k times the size of the optimum.

• Gives: for each , there is an -approximation algorithm whose time is polynomial in n (but exponential in 1/ .)

• Method has been extended in several ways.

Page 32: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek32

2. Computing treewidth: exact algorithms

• For applications: needed to compute the treewidth of a given graph

– Interaction between theoretical and experimental work

• Overview of some results • First: exact algorithms

Page 33: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek33

The problem

• Given: Graph G

• Question: what is the treewidth of G?• Or: Give a tree decomposition with minimum

(close to minimum) treewidth• Decision problem version:

– Given: Graph G, integer k– Question: is the treewidth of G at most k.

• Both of theoretical and practical interest

Page 34: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek34

Exact methods

• Arnborg, Corneil, Proskurowski, 1987: problem is NP-complete

• Special cases have been studied:

– NP-complete for graphs of degree at most 9 (B, Thilikos), bipartite graphs, cobipartite graphs, …

– Polynomial time algorithms for chordal graphs, circular arc graphs, permutation graphs, distance hereditary graphs

– Open: planar graphs. (Polynomial time algorithm for the related problem of branchwidth for planar graphs.)

Page 35: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek35

Graphs with polynomially many separators

• Bouchitté, Todinca (2002, 2003): Polynomial time algorithm to compute the treewidth of graphs with polynomially many minimal separators.

– Using potential maximal cliques

– There is always a tree decomposition whose bags are potential maximal cliques

– All pmc’s can be listed in time polynomial in nb of minimal separators (Bouchitté Todinca)

– Fitting together pmc’s to make tree decomposition

Page 36: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek36

Fixed parameter case

• Important special case: k fixed

• Arnborg, Corneil, and Proskurowski (1987): O(nk+2) time

• Linear time algorithm, 1996: B, using a result with Kloks.

– Big constant factor: (n) time…

– Hein Röhrig: feasibility study (1998).

• Special cases: k=1 (forests); k=2, k=3 (Arnborg, Proskurowski, 1986; Matousek, Thomas); k=4 (Sanders).

– Work with reduction. To be explained later

Page 37: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek37

Branch and Bound algorithm

• Gogate, Dechter, 2004: Branch and Bound algorithm for treewidth– Builds a permutation of the vertices:

• For each vertex v:– Choose v as first vertex and add fill-in edges for

v– Run a lower bound heuristic on the new graph

and possibly stop this branch– Otherwise recurse (next time finding 2nd vertex,

etc.)– Rules to limit nb of branches

Page 38: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek38

3. Upper bound heuristics and approximation algorithms

• Different methods and heuristics

– Finding repeatedly separators– Refining a tree decomposition– Building a permutation

• Some have guarantees on performance, others not.

Page 39: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek39

Approximation algorithms

• Polynomial in n, but exponential in k: Robertson, Seymour; Lagergren; Reed; Becker, Geiger, Amir: e.g.– Algorithm that uses O(f(k) n log n) time and either tells

treewidth(G)>k, or finds tree decomposition of width at most 6k.

• Polynomial time algorithm with O(log n) approximation ratio (B,Gilbert,Hafsteinsson,Kloks, 1995).

• Polynomial time algorithm with O(log k) approximation ratio: Bouchitté, Kratsch, Müller, Todinca; Amir; k optimal treewidth (2001)Amir: 720 log k in O(n3 log4n k5 log k) time.

Page 40: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek40

Method

Procedure BuildTD (Graph G, set W)

• Find a set S, such that each connected component of G-S has only few vertices of W

• For each component Zi of G – S do

– BuildTD( G[Z S, S (W Z))

• Fit together the tree decompositions:

S W

SWZ1)…

Page 41: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek41

Variants

• Algorithms of Robertson and Seymour, B et al, Bouchitté et al, Lagergren, Amir differ in how they find separators, what size of separators, and small other details

• Koster and Bouchitté et al. also have heuristics that start with one trivial tree decomposition (one bag with all vertices), and then refine.

Page 42: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek42

Heuristics with permutations

• Successful method for upper bound heuristics (Folklore):

– Build in some way a permutation of G.– Make the fill-in (perhaps during building )– Translate to tree decomposition

• Koster, B, van Hoesel 2001: experiments with several such heuristics

Page 43: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek43

Minimum degree heuristic

• Choose a vertex v in G of minimum degree

• Make a clique of the neighbours of v

• Build permutation of G-v (or tree decomposition)

• Add v in front (or construct tree decomposition of G)

N(v)…

i*

N(v)v

N(v)…

i*

Page 44: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek44

Minimum fill-in heuristic• Choose a vertex v in G of such

that the number of pairs of unadjacent neighbours (= nb of fill-in edges for this vertex v) is as small as possible

• Make a clique of the neighbours of v

• Build permutation of G-v (or tree decomposition)

• Add v in front (or construct tree decomposition of G)

N(v)…

i*

N(v)v

N(v)…

i*

Page 45: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek45

Experimental results

• Minimum degree and minimum fill-in perform very well in practice

– Fast– Often best results

• Not always minimal triangulation– Improve result by using algorithm by Blair,

Heggernes, Telle for making minimal triangulations given a triangulation

Page 46: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek46

Other upper bound heuristics

• Kjaerulff: Simulated annealing for related problem

• Work on genetic algorithms• Clautiaux et al. (2004): Tabu search

– Representing solutions by permutations, and using steps that insert vertices on different spots, etc.

Page 47: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek47

4. Lower bounds

• Useful for

– Branch and bound– Informing on quality of upper bounds– Telling uselessness of treewidth approach for

some graphs• Joint work with Koster and Wolle

Page 48: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek48

Our first lower bounds

• Minimum degree– If G has a tree

decomposition of width k, then it has a vertex of degree at most k.

• Helpful for improvement:– If H is a subgraph of

G, then the treewidth of G is at least the treewidth of H.

Degeneracy:• k = 0;• While G is not the empty

graph do– Take a vertex v of

minimum degree d– k = max(d,k)– Remove v from G

The degeneracy is a lower bound for treewidth

Page 49: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek49

Contraction• Contraction of an edge does

not increase the treewidth

– Take tree decomposition

– If we contract {v,w}, replace v and w in each bag by the vertex representing the contraction

– This is a tree decomposition of the new graph

v w

x

v v… w

...

… w…

x x…

...

… x…

Page 50: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek50

• Lower bound improving upon degeneracy– k = 0;– While G is not the empty graph do

• Take a vertex v of minimum degree d• k = max(d,k)• Contract v with a neighbour

• Different tiebreaking rules– Neighbour of minimum degree– Neighbour of maximum degree (bad)– Neighbour with minimum nb of common neighbours

(best)

Contraction degeneracy

v

w

x

Page 51: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek51

Some resultsInstance |V| |E| MMD cpu MMD+ cpulink 724 1738 4 0.00 8 0.02link-pp 308 1158 6 0.00 8 0.01munin1 189 366 4 0.00 8 0.01munin1-pp 66 188 4 0.00 8 0.00pignet2 3032 7264 4 0.02 29 0.15pignet2-pp 1024 3774 5 0.00 29 0.10celar06pp 82 327 10 0.00 11 0.00graph11 340 1425 7 0.01 17 0.02graph11-pp 307 1338 7 0.01 16 0.02graph13 458 1877 6 0.00 18 0.03graph13-pp 420 1772 6 0.00 19 0.04

MMD = degeneracyMMD+ = contraction degeneracy

Page 52: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek52

Improvement: technique by Clautiaux et al

Fact: If v and w have k+1 vertex disjoint paths and treewidth of G is at most k, then the treewidth of G + {v,w} is at most k.

• Initialize lower bound L.• Repeat:

– G’=G;– While there are non-

adjacent v and w with L+1 disjoint paths (or: common neighbours)

• add the edge {v,w} to G’.

– Compute lower bound L’ of G’.

– If L’ > L then L++Until L=L’.

v

wv

w

Any method canbe used here

Page 53: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek53

MMD cpuMMD,

MCSLB cpu MMD+ cpuMMD+, MCSLB cpu

link 8 10 3958.5 10 5509.2 10 153.66 10 220.71link-pp 8 10 86.65 10 98.01 10 38.19 10 50.67munin1 9 7 5.63 7 6.31 9 0.57 9 2.25munin1-pp 9 7 0.99 7 1.14 8 0.06 9 0.55pignet2 29 - - - - 31 816.91 31 1804.2pignet2-pp 30 27 20434 27 29191 32 221.37 32 381.36celar06pp 11 11 0.38 11 0.53 11 0.1 11 0.58graph11 17 12 3404.1 12 5420.1 17 0.07 17 8.1graph11-pp 18 13 1035.9 13 1734.4 16 0.06 16 6.91graph13 20 12 45234 12 69516 18 0.1 18 14.96graph13-pp 20 13 6202.5 13 10183 19 0.1 19 13.77

Instance Best

LB_P(*)

MMD = degeneracyMMD+ = contraction degeneracy heuristicMCSLB = maximum cardinality search heuristic

Page 54: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek54

Maximum Cardinality Search

• Simple mechanism to make a permutation of the vertices of an undirected graph

• Let the visited degree of a vertex be its number of visited neighbours

• Pseudocode for MCS:– Repeat

• Visit an unvisited vertex that has the largest visited degree

– Until all vertices are visited

Page 55: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek55

Example: a 4-clique with one subdivision

a

bc

d

e

Page 56: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek56

We can start at any vertex: each vertex has 0 visited neighbours

0

0

0

0

0

a

bc

d

e

a, …

Page 57: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek57

Say, we start at a

0

1

1

0

1

a

bc

d

e

a, …The next vertexmust be b, c, ord. It can not e.

Page 58: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek58

After b, we must visit c.

0

1

2

1

1

a

bc

d

e

a, b, …

Page 59: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek59

And then d

0

1

2

1

2

a

bc

d

e

a, b, c, …

Page 60: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek60

And finally e

0

1

2

1

2

a

bc

d

e

a, b, c, d, …

Page 61: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek61

We made an MCS-ordering of the graph

0

1

2

2

2

a

bc

d

e

a, b, c, d, e …

Page 62: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek62

On Maximum Cardinality Search

• Introduced by Tarjan and Yannakakis (1984) for recognition of chordal (triangulated) graphs

• Used as an upper bound heuristic for treewidth– (with fill-in edges)– Slightly inferior to minimum degree or

minimum fill-in (slower and usually not better)• Lucena (SIAM J. Disc. Math., 2003): method to

get lower bound for treewidth

Page 63: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek63

Lucena’s theorem

• If we have an MCS-ordering of G, and a vertex is visited with visited degree k, then the treewidth of G is at least k.

• Task: find an MCS-ordering such that the largest visited degree of a vertex (at time of its visit) is as large as possible.

– NP-hard, but heuristics

• Running (a few times) an MCS and reporting maximum visited degree gives lower bound for treewidth: small improvement, slower

Page 64: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek64

Graph or Bear?

Page 65: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek65

Other degree based lower bounds

• One-but-smallest degree is also lower bound for treewidth

• Ramachandramurthi:– Minimum over all pairs of non-adjacent

vertices v, w of max(degree(v),degree(w)• Combining these bounds with contraction gives

small improvements to lower bounds• LPN+ and LBP+: alternate LBN or LBP-steps

with contraction: gives excellent results

Page 66: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek66

5. Pre-processing

• Translate the graph to a smaller, equivalent instance

– Reduction rules– Safe separators

• Joint work with Koster, van den Eijkhof, van der Gaag

Page 67: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek67

Two types of pre-processing

• Reduction rules (Simplification)

– Rules that change G into a smaller `equivalent’ graph

– Maintains a lower bound variable for treewidth low

• Safe separators (Divide and Conquer)– Splits the graph into two or more smaller parts

with help of a separator that is made to a clique

Page 68: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek68

Reduction

• Safe rules that

– Make G smaller

– Maintain optimality…

• Use for pre-processing networks when computing treewidth

Input graph G

Reduced graph H

Solution H

Preprocess

Solve H

Undo preprocessing

Solution G

Page 69: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek69

Reduction rules

• Work by B, Koster, van den Eijkhof, van der Gaag

• Uses and generalizes ideas and rules from algorithm to recognize graphs of treewidth 3 from Arnborg and Proskurowski

Page 70: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek70

A safe rule

• Example: series rule: remove a vertex of degree 2 and connect its neighbours

• Safe for graphs of treewidth 2

v

Series rule

Original graph Reduced graph

Page 71: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek71

Example

Reduce

Undo reductions

a b c

de f

g

a b

e f

a be f

c

g

Solve

a be f

e f

gfe

a be f

gfe

b

b

f

fca be f

gfe

bfc

dc f

Page 72: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek72

• Variable: low (integer, lower bound on treewidth)• Graph G• Invariant: value of max(low, treewidth(G))• Rules

– Locally rewrite G to a graph with fewer vertices– Possibly update or check low

• We say a rule is safe, when it maintains the invariant. Use only safe rules.

Type of rules

Page 73: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek73

Rule 1: Simplicial rule

• Let v be a simplicial vertex in G

• Remove v.

• Set low := max (low, degree(v))

• Simplicial rule is safe.

Simplicial =Neighbors form a clique

Page 74: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek74

Rule 2: Almost Simplicial rule

• v is almost simplicial, when the neighbours of v except one form a clique.

If v is almost simplicial, and low degree(v)

Then remove v and turn its neighbours into a clique

almost simplicial rule

Page 75: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek75

• Generalizes:

– Series rule (a vertex of degree 2 is almost simplicial)

– Triangle rule (Arnborg, Proskurowski)

• Is safe

– tw(G’) tw(G)

– Tree decomposition of G can be made from one of G’ by adding one node with cardinality degree(v)+1 low+1

On the almost simplicial rule

……

Page 76: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek76

Buddy rule

• If:

– Low 3

• Then

– Remove v1 and v2

– Add edges between x1, x2 and x3.

buddy rule

v1

x1

v2

x1

x3

x2x2

x3

Generalization: Buddies rule:d vertices, each with the same d+1 neighbours

Page 77: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek77

(Extended) Cube rule

• If low 3

Also from work of Arnborg and Proskurowski

Page 78: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek78

instance | V| | E| | V| | E| low instance | V| | E| | V| | E| lowalarm 37 65 0 0 4 oesoca+ 67 208 14 75 9barley 48 126 26 78 4 oesoca 39 67 0 0 3boblo 221 328 0 0 3 oesoca42 42 72 0 0 3diabetes 413 819 116 276 4 oow-bas 27 54 0 0 4link 724 1738 308 1158 4 oow-solo 40 87 27 63 4mildew 35 80 0 0 4 oow-trad 33 72 23 54 4munin1 189 366 66 188 4 pignet2 3032 7264 1002 3730 4munin2 1003 1662 165 451 4 pigs 441 806 48 137 4munin3 1044 1745 96 313 4 ship-ship 50 114 24 65 4munin4 1041 1843 215 642 4 vsd 38 62 0 0 4munin-kgo 1066 1730 0 0 5 water 32 123 22 96 5

wilson 21 27 0 0 3

original preprocessedoriginal preprocessed

Some results for probabilistic networks

Sometimes to optimality; often significant reductions

Page 79: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek79

Experiments

• Some cases could be solved with pre-processing to optimality

• Often substantial reductions obtained• Applied to instances obtained from `real’

probabilistic networks• Time needed for pre-processing was small (never

more than a few seconds)

Page 80: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek80

Safe separators

• S is a separator of G, if G-S has more than one connected component

• S is a minimal separator, if S is a separator and S does not contain another separator as proper subset

S

Page 81: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek81

Safe separator

S is safe for treewidth, or `a safe separator’ iff

– The treewidth of G equals the maximum over the treewidth of all graphs obtained by

• Taking a connected component W of G-S

• Take the graph, induced by W S

• Make S into a clique in that graph

+

Page 82: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek82

Using safe separators

• Splitting the graph for divide and conquer pre-processing

• Until no safe separators can be found• Slower but more powerful compared to reduction

– Most or all reduction rules can be obtained as special cases of the use of safe separators

• Look for sufficient conditions for separators to be safe

Page 83: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek83

A theorem

• The following separators are safe:– Separators of size 0, 1– Minimal separators of size 2– Minimal separators of size 3 that split off at

least two vertices– Clique separators– Minimal `almost clique’ separators:

• S is an almost clique when S – v is a clique for some v

Page 84: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek84

On safeness of clique separators

• If S is a clique separator, then the treewidth of G equals the treewidth over all components W of G – S of G[S W].

Subgraphs cannot havelarger treewidth

Page 85: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek85

On safeness of clique separators

• If S is a clique separator, then the treewidth of G is equals the treewidth over all components W of G – S of G[S W].

A tree decompositioncan be build from

tree decompositionsof the subgraphs

Page 86: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek86

Splitting on an almost clique separator

Page 87: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek87

An almost clique separator is safe

• Each smaller graph we look at can be obtained by contracting edges in G– So has treewidth at

most the treewidth of G

• A tree decomposition of G can be build from tree decompositions for the smaller graphs

Page 88: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek88

An almost clique separator is safe

• Each smaller graph we look at can be obtained by contracting edges in G

– So has treewidth at most the treewidth of G

• A tree decomposition of G can be build from tree decompositions for the smaller graphs

Page 89: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek89

Plan

• Search safe separators of size 1, 2, 3, clique and almost clique separators. Repeat on parts; possibly combining for speed with reductions.

• When pre-processing stops, apply other methods:– E.g.: Branch and Bound – Or heuristics. E.g.: apply a heuristic first on

each part, and then try to improve (e.g., with B&B) the most expensive parts.

Page 90: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek90

Some results forprobabilistic networks

instance |V| |E| cliquealmost-clique size 3 # graphs # cliques# To Do low

barley-pp 26 78 0 7 0 8 7 1 5diabetes-pp 116 276 0 85 0 86 84 2 4link-pp 308 1158 0 0 0 1 0 1 4munin1-pp 66 188 0 2 0 3 2 1 4munin2-pp 165 451 6 13 4 24 12 12 4munin3-pp 96 313 2 2 2 7 4 3 4munin4-pp 215 642 3 4 0 8 2 6 4oesoca+-pp 14 75 0 0 0 1 0 1 9oow-trad-pp 23 54 0 0 1 2 1 1 4oow-solo-pp 27 63 0 0 1 2 0 2 4pathfinder-pp 12 43 0 5 0 6 6 0 6pignet2-pp 1002 3730 0 0 0 1 0 1 4pigs-pp 48 137 0 1 0 2 1 1 5ship-ship-pp 24 65 0 0 0 1 0 1 4water-pp 22 96 0 1 0 2 1 1 6

size separators output

Page 91: Discovering Treewidth Hans L. Bodlaender, Utrecht University.

Algoritmiek91

Conclusions

• Treewidth is a useful tool to solve graph problems for several special instances, both for theory and for practice

• Theoretical results with additional ideas give practical algorithms that work in many cases well

• Algorithms of different types: exact, upper bound heuristics and approximations, lower bounds, pre-processing