1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender...

Post on 15-Dec-2015

220 views 4 download

Transcript of 1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender...

1

Steiner Tree

on graphs of small treewidth

Algorithms and Networks 2014/2015Hans 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)

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.

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?

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

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

7

Leaf

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

v

8

Join nodes

Identify the two subgraphs on the vertices in the bag

+=

9

Forget nodes

Same graph – one vertex is no longer ‘boundary’

v v

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

11

Introduce edge node

Adds an edge between two terminals

v v

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

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

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

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

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

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

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

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

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

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

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

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!!!

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

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)

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

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