1 steiner tree on graphs of small treewidth algorithms and networks 2014/2015 hans l. bodlaender...

27
1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

Upload: lea-folsom

Post on 15-Dec-2015

217 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

1

Steiner Tree

on graphs of small treewidth

Algorithms and Networks 2014/2015Hans L. Bodlaender

Johan M. M. van Rooij

Page 2: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

2

This lecture

Steiner Tree Recap

Steiner Tree on Graphs of Small Treewidth What do we store at tables Computing on Nice Tree Decompositions Improvement using Rank Based Approach

Based on work by: B, Cygan, Kratsch, Nederlof (2013) Fafianie, B, Nederlof (2013)

Page 3: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

3

The Steiner Tree Problem

Let G = (V,E) be an undirected graph, and let N µ V be a subset of the terminals.

A Steiner tree is a tree T = (V’,E’) in G connecting all terminals in N V’ µ V, E’ µ E, N µ V’ We use k=|N|.

Streiner tree problem: Given: an undirected graph G = (V,E), a terminal set N µ V, and

an integer t. Question: is there a Steiner tree consisting of at most t edges

in G.

Page 4: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

4

Discussed results

Steiner Tree is NP-complete Distance network Steiner Tree, parameterized by number of terminals is FPT:

with k terminals, can be solved in O(2k p(n)) time Today an algorithm using O(ck n) time for:

Given: Connected graph G, set of terminals W, tree decomposition of G of width at most k

Question: What is the minimum number of edges of a tree that connects all terminals?

And the weighted variant: Given: Connected graph G, set of terminals W, tree

decomposition of G of width at most k, weight for each edge Question: What is the minimum total weight of a tree that

connects all terminals?

Page 5: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

5

Nice tree decompositions of special type

Five types of nodes: Leaf (as before) Join (as before) Forget (as before) Introduce vertex (add a vertex, but without edges) Introduce edge (add an edge between two terminals)

We assume in addition: The root of the tree decomposition is a bag with one vertex: a

terminal

Page 6: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

6

To each bag, we associate a subgraph G(i)

Bag i: All vertices in bags in subtree rooted by i All edges that are introduced in subtree rooted by i

Page 7: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

7

Leaf

G(i) is graph with one vertex and no edges:

v

Page 8: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

8

Join nodes

Identify the two subgraphs on the vertices in the bag

+=

Page 9: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

9

Forget nodes

Same graph – one vertex is no longer ‘boundary’

v v

Page 10: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

10

Introduce vertex nodes

In an introduce vertex node, a new vertex (say v) is added to G(i): at this point, v has no incident edges (yet)

v Degree0 now

Page 11: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

11

Introduce edge node

Adds an edge between two terminals

v v

Page 12: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

12

Partial solutions (1)

If we have a Steiner tree T in G, how does the part of T in G(i) look like?

v w

b

a

a, b terminals

Page 13: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

13

Partial solutions (2)

If we have a Steiner tree T in G, how does the part of T in G(i) look like?

Maybe like this:

v w

b

a

a, b terminals

Page 14: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

14

Partial solutions (3)

If we have a Steiner tree T in G, how does the part of T in G(i) look like?

Or this:

v w

b

a

a, b terminals

Page 15: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

15

Partial solutions (4)

If we have a Steiner tree T in G, how does the part of T in G(i) look like?

But not this: We cannot connect a and b to other terminals outside G(i)

v w

b

a

a, b terminals

Page 16: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

16

Partial solutions (5)

A partial solution is a forest in G(i), such that Each tree contains a vertex in the bag/boundary X(i) Each terminal in G(i) belongs to a tree in the forest

Or, differently said: each terminal is connected to the boundary bag

Next step: characterize such forests with finite information

Page 17: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

17

Characteristic of partial solution

A characteristic of a partial solution for G(i) is: A subset S of the vertices in X(i):

• the vertices in X(i) that belong to the forest A partition of S

• Two vertices belong to the same partition, if and only if they are connected in the forest

Page 18: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

18

Example characterics (weighted example)

{{a,b,c}}, 10 {{a,b,c}}, 11 {{a},{b,c}}, 3

Table: {{a},{b},{c}}, 0 {{a},{b,c}}, 3 {{b},{a,c}}, 9 {{c},{a,b}}, 7 {{a,b,c}}, 10

b c8 36 1 1

2

8 36 1 1

2

a

b c

48 3

6 1 1

a

2

Page 19: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

19

DP

For each bag, compute a table: For each possible characteristic, what is the minimum weight

of a partial solution (forest fulfilling criteria) with that characteristic

Compute these tables bottom up in the tree Root bag gives the answer

Remember: the root bag had one vertex, a terminal Only one possible characteristic in table for the root Its value gives the answer

Page 20: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

20

Computing tables

Leaf: trivial Forget: discard characteristics with the forgotten vertex as only

element in a partition (becomes never connected) Join: try all combinations of characteristics and compute

resulting characteristics Introduce vertex:

For each element of child bag table: Add characteristic with introduced vertex as single element in

partition Add characteristic with introduced vertex not in forest

Introduce edge: For each element of child bag table: If both endpoints in forest: Add characteristic with introduced edge

in the forest: this increases width and joins two forests Add unchanged characteristic: edge not used in forest

Page 21: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

21

?

Improvement: intuition

It is sufficient to have something for all different futures … if you have a set of insurance policies, such that each

possible event in the future is covered by at least one of these, you do not need an additional insurance policy

The future is here: a forest in the “other part”

54

48 3

6 1 12

8 36 1 1

2

Page 22: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

22

Connectivity matrix

Rows and columns marked with partitions Entry is 1 if: row+ column partition connect all

a – b - c ab - c ac - b bc - a abc

a – b - c 0 0 0 0 1

ab - c 0 0 1 1 1

ac - b 0 1 0 1 1

bc - a 0 1 1 0 1

abc 1 1 1 1 1

Page 23: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

23

The connectivity matrix1 iff partitions joined connect all

a – b - c ab - c ac - b bc - a abc

a – b - c 0 0 0 0 1

ab - c 0 0 1 1 1

ac - b 0 1 0 1 1

bc - a 0 1 1 0 1

abc 1 1 1 1 1

Table:a – b – c: 0ab – c: 7ac – b: 9bc – a: 7abc: 10

Not needed!!!

Page 24: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

24

Linear combinations

If row i is a linear combination (when computing mod 2) of other rows, but is at least as expensive as these, then we do not need the solution of row i. For any future that helps i, we have an entry that is as least as

good, and is also helped by this future…

a – b - c ab - c ac - b bc - a abc

a – b - c 0 0 0 0 1

ab - c 0 0 1 1 1

ac - b 0 1 0 1 1

bc - a 0 1 1 0 1

abc 1 1 1 1 1

079710

Page 25: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

25

Rank

Theorem (without proof): The connectivity matrix on r elements has rank 2r-1 … and the partitions in at most 2 sets form a basis

Each column with partition p can be written as sum of the columns in 2 sets that it refines (except the trivial partition)

Page 26: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

26

The reduce step

This enables a reduce step: if a table has more than 2|W| elements with the same vertices W in the forest, then we can delete some superfluous table entries:

Let W be the vertices in X(i) in the forest. Build part of the connectivity matrix:

Rows are the entries in the current table with W as forest vertices

Columns are partitions in at most two sets of W Perform Gaussian elimination:

Find rows that are linear combination of less or equally expensive rows, and delete the corresponding entries

Page 27: 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

27

Wrapping up

Table size after reduction step is bounded by 3tw. Running time is dominated by Gaussian elimination step

and join nodes: O(ctwn) Implementation: works fast for real-life graphs

Proper representation, choice of data structures helps a lot