complexity theory of polynomial-time problems

Post on 23-Apr-2022

4 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Complexity Theory of Polynomial-Time Problems

Karl Bringmann

Lecture 8: (Boolean) Matrix Multiplication

Recall: Boolean Matrix Multiplication

given ๐‘›ร—๐‘› matrices ๐ด, ๐ต with entries in {0,1}compute matrix ๐ถ with ๐ถ+,, = โ‹ ๐ด+,/ โˆง ๐ต/,,1

/23

what we already know about BMM:

BMM is in time ๐‘‚(๐‘›6/ log๐‘›) (four Russians)

BMM is equivalent to computing the Transitive Closure of a given graph

BMM can be reduced to APSP โ†’ ๐‘‚(๐‘›6/2 ?@A 1)

โ‹ฎ โ‹ฎโ‹ฎ๐‘› ๐‘›๐‘›

๐œ” โ‰ค โ€ฆStrassenโ€™69 2.81Panโ€™78 2.79

Bini et al.โ€™79 2.78

Schรถnhageโ€™80 2.52

Romaniโ€™80 2.52

Coppersmith,Winogradโ€™81 2.50

Strassenโ€™86 2.48

Coppersmith,Winogradโ€™90 2.376

Stothersโ€™10 2.374

Vassilevska-Williamsโ€™11 2.37288

Le Gallโ€™14 2.37287

Exponent of Matrix Multiplication

define ๐œ” as the infimum over all ๐‘ such that MM has an ๐‘‚(๐‘›F ) algorithm

note: MM is in time ๐‘‚(๐‘›GHI) for any ๐œ€ > 0

we will be sloppy and write: MM is in time ๐‘‚(๐‘›G)

Thm: ๐œ” < 3

this is very fast โ€“ in theory

all these algorithms have impractically large constant factors

(maybe except Strassenโ€™69)

note: MM is not in time ๐‘‚(๐‘›GNI) for any ๐œ€ > 0 ๐œ” โ‰ฅ 2

Boolean Matrix Multiplication

Thm: BMM is in time ๐‘‚(๐‘›G)

given ๐‘›ร—๐‘› matrices ๐ด, ๐ต with entries in {0,1}

compute standard matrix product ๐ถโ€ฒ with ๐ถ+,,Q = โˆ‘ ๐ด+,/ โ‹… ๐ต/,,1+23

define matrix ๐ถ with ๐ถ+,, = [๐ถ+,,Q > 0]

then ๐ถ is the Boolean matrix product of ๐ด and ๐ต

Hypothesis: BMM is not in time ๐‘‚(๐‘›GNI)

Combinatorial Algorithms

fast matrix multiplication uses algebraic techniques which are impractical

โ€œcombinatorial algorithmsโ€: do not use algebraic techniques

not well defined!

Arlazarov,Dinic,Kronrod, Faradzhevโ€˜70 (four russians)

๐‘‚(๐‘›6/logV๐‘›)

Bansal,Williamsโ€™09 ๐‘‚(๐‘›6 log log ๐‘› V/logW/X๐‘›)

Chanโ€™15 ๐‘‚(๐‘›6 log log ๐‘› 6/log6๐‘›)Yuโ€™15 ๐‘‚(๐‘›6poly log log ๐‘› /logX๐‘›)

Hypothesis: BMM has no โ€œcombinatorialโ€ algorithm in time ๐‘‚(๐‘›6NI)

In this lecture you learn that...

โ€ฆ(B)MM is useful for designing theoretically fast algorithms

- Exercise: k-Clique in ๐‘‚(๐‘›G//6)

no combinatorial ๐‘‚(๐‘›6NI)

- Exercise: MaxCut in ๐‘‚(2G1/6poly(๐‘›))- Node-Weighted Negative Triangle in ๐‘‚(๐‘›G)

โ€ฆBMM is an obstacle for practically fast / theoretically very fast algorithms

not faster than ๐‘‚(๐‘›V.6\6)

- Exercise: pattern matching with 2 patterns

- Sliding Window Hamming Distance

- Transitive Closure has no ๐‘‚(๐‘›GNI) / combinatorial ๐‘‚(๐‘›6NI) algorithm

- context-free grammar problems

Outline

1) Relations to Subcubic Equivalences

2) Strassenโ€™s Algorithm

3) Sliding Window Hamming Distance

4) Node-Weighted Negative Triangle

5) Context-Free Grammars

Corollaries from Subcubic Equivalences

given an unweighted graph ๐บ

does it contain a triangle?

BMM

โŸบ

Triangle

โŸบ

All-Pairs-Triangle

given an unweighted graph ๐บ

vertices ๐‘‰ = ๐ผ โˆช ๐ฝ โˆช ๐พ

โˆ€๐‘–, ๐‘—: are they in a triangle with some ๐‘˜?

APSP

Min-Plus Product

All-Pairs-Negative-Triangle

โŸบโŸบ

Negative Triangle

โŸบ

[Vassilevska-Williams,Williamsโ€™10]

Corollaries from Subcubic Equivalences

BMM

โŸบ

Triangle

โŸบ

All-Pairs-Triangle

APSP

Min-Plus Product

All-Pairs-Negative-Triangle

โŸบโŸบ

Negative Triangle

โŸบ

โ‹ฎ โ‹ฎโ‹ฎ๐‘› ๐‘›๐‘›

๐ด ๐ต

๐ผ ๐พ ๐ฝ

Corollaries from Subcubic Equivalences

BMM

โŸบ

Triangle

โŸบ

All-Pairs-Triangle

APSP

Min-Plus Product

All-Pairs-Negative-Triangle

โŸบโŸบ

Negative Triangle

โŸบGiven an unweighted undirected graph ๐บ

Adjacency matrix ๐ด, entries in {0,1}

1. Compute Boolean Product ๐ถ โ‰” ๐ด โˆ— ๐ด:

๐ถ+,, =k ๐ด+,/ โˆง ๐ด/,,/

2. Compute โ‹ ๐ด+,, โˆง ๐ถ+,,+,,

this equals k ๐ด+,, โˆง ๐ด+,/ โˆง ๐ด/,,+,,,/

thus we solved triangle detection

Corollaries from Subcubic Equivalences

BMM

โŸบ

Triangle

โŸบ

All-Pairs-Triangle

APSP

Min-Plus Product

All-Pairs-Negative-Triangle

โŸบโŸบ

Negative Triangle

โŸบ

All-Pairs-Triangle to Triangle All-Pairs-Triangle

TriangleDecide whether there are vertices ๐‘–, ๐‘—, ๐‘˜ such that๐‘–, ๐‘—, ๐‘˜ form a triangle

Triangle

All-Pairs-TriangleDecide for every ๐‘– โˆˆ ๐ผ, ๐‘— โˆˆ ๐ฝ whether there is a vertex ๐‘˜ โˆˆ ๐พ such that

๐‘–, ๐‘—, ๐‘˜ form a triangle

Given graph ๐บ

Given graph ๐บ with vertex set ๐‘‰ = ๐ผ โˆช ๐ฝ โˆช ๐พ

Split ๐ผ, ๐ฝ, ๐พ into ๐‘›/๐‘  parts of size ๐‘ :

For each of the (๐‘›/๐‘ )6triples (๐ผn, ๐ฝo,๐พp):consider graph ๐บ[๐ผn โˆช ๐ฝo โˆช ๐พp]

๐ผ3,โ€ฆ , ๐ผ1/r,๐ฝ3 , โ€ฆ , ๐ฝ1/r, ๐พ3,โ€ฆ , ๐พ1/r

๐ผn

๐พp

๐ฝo

๐ผ

๐พ

๐ฝ

All-Pairs-Triangle to Triangle

For each of the (๐‘›/๐‘ )6triples of parts (๐ผn, ๐ฝo,๐พp):

While ๐บ[๐ผn โˆช ๐ฝo โˆช ๐พp]contains a triangle:Find a triangle (๐‘–, ๐‘—, ๐‘˜) in ๐บ[๐ผn โˆช ๐ฝo โˆช ๐พp]

Initialize ๐ถ as ๐‘›ร—๐‘› all-zeroes matrix

Set ๐ถ ๐‘–, ๐‘— โ‰” 1Delete edge (๐‘–, ๐‘—)

(๐‘–, ๐‘—) is in no more triangles

๐ผn

๐พp

๐ฝo

๐ผ

๐พ

๐ฝโœ” guaranteed termination:

โœ” correctness:

can delete โ‰ค ๐‘›V edges

if (๐‘–, ๐‘—)is in a triangle, we will find one

All-Pairs-Triangle

Triangle

All-Pairs-Triangle to Triangle

Find a triangle (๐‘–, ๐‘—, ๐‘˜) in ๐บ[๐ผn โˆช ๐ฝo โˆช ๐พp]

How to find a triangleif we can only decide whether one exists?

Partition ๐ผn into ๐ผn(3), ๐ผn(V), ๐ฝo into ๐ฝo(3), ๐ฝo(V), ๐พp into ๐พp(3),๐พp(V)

๐ผn

๐พp

๐ฝo

Since ๐บ[๐ผn โˆช ๐ฝo โˆช ๐พp] contains a triangle,at least one of the 26 subgraphs

๐บ[๐ผn(s) โˆช ๐ฝo(t) โˆช ๐พp(F)]contains a triangle

Decide for each such subgraph whetherit contains a triangle

Recursively find a triangle in one subgraph

All-Pairs-Triangle

Triangle

All-Pairs-Triangle to Triangle

Find a triangle (๐‘–, ๐‘—, ๐‘˜) in ๐บ[๐ผn โˆช ๐ฝo โˆช ๐พp]

How to find a triangleif we can only decide whether one exists?

Partition ๐ผn into ๐ผn(3), ๐ผn(V), ๐ฝo into ๐ฝo(3), ๐ฝo(V), ๐พp into ๐พp(3),๐พp(V)

Since ๐บ[๐ผn โˆช ๐ฝo โˆช ๐พp] contains a triangle,at least one of the 26 subgraphs

๐บ[๐ผn(s) โˆช ๐ฝo(t) โˆช ๐พp(F)]contains a triangle

Decide for each such subgraph whetherit contains a triangle

Recursively find a triangle in one subgraph

๐‘‡vwxyz{w|xA?} ๐‘› โ‰ค

26 โ‹… ๐‘‡~}๏ฟฝwy}z{w|xA?}(๐‘›)

+๐‘‡vwxyz{w|xA?} ๐‘›/2

= ๐‘‚(๐‘‡~}๏ฟฝwy}z{w|xA?} ๐‘› )

Running Time:

All-Pairs-Triangle

Triangle

All-Pairs-Triangle to Triangle

For each of the (๐‘›/๐‘ )6triples of parts (๐ผn, ๐ฝo,๐พp):

While ๐บ[๐ผn โˆช ๐ฝo โˆช ๐พp]contains a triangle:Find a triangle (๐‘–, ๐‘—, ๐‘˜) in ๐บ[๐ผn โˆช ๐ฝo โˆช ๐พp]

Initialize ๐ถ as ๐‘›ร—๐‘› all-zeroes matrix

Set ๐ถ ๐‘–, ๐‘— โ‰” 1Delete edge (๐‘–, ๐‘—)

(โˆ—) = ๐‘‚(๐‘‡vwxyz{w|xA?}(๐‘ )) = ๐‘‚(๐‘‡~}๏ฟฝwy}z{w|xA?}(๐‘ ))Running Time:

(โˆ—)

Total time: #triples + #trianglesfound โ‹… (โˆ—)

โ‰ค ๐‘›/๐‘  6 + ๐‘›V โ‹… ๐‘‡~}๏ฟฝwy}z{w|xA?}(๐‘ )

Set ๐‘  = ๐‘›3/6 and assume ๐‘‡~}๏ฟฝwy}z{w|xA?} ๐‘› = ๐‘‚(๐‘›6NI)

Total time: ๐‘‚ ๐‘›V โ‹… ๐‘›3NI/6 = ๐‘‚(๐‘›6NI/6)

All-Pairs-Triangle

Triangle

Corollaries from Subcubic Equivalences

BMM

โŸบ

Triangle

โŸบ

All-Pairs-Triangle

APSP

Min-Plus Product

All-Pairs-Negative-Triangle

โŸบโŸบ

Negative Triangle

โŸบIf BMM has (combinatorial)๐‘‚(๐‘›6NI) algorithmthen Triangle has (combinatorial) ๐‘‚ ๐‘›6NI algorithm

If Triangle has (combinatorial) ๐‘‚(๐‘›6NI) algorithmthen BMM has (combinatorial) ๐‘‚ ๐‘›6NI/6 algorithm

โ†’ subcubic equivalent, but this mainly makes sense for combinatorial algorithms

Outline

1) Relations to Subcubic Equivalences

2) Strassenโ€™s Algorithm

3) Sliding Window Hamming Distance

4) Node-Weighted Negative Triangle

5) Context-Free Grammars

Strassenโ€˜s Algorithm

shows ๐œ” โ‰ค 2.81๐ด ๐ต ๐ถ

โ‹… =๐ด3,3 ๐ด3,V

๐ดV,3 ๐ดV,V

๐ต3,3 ๐ต3,V

๐ตV,3 ๐ตV,V

๐ถ3,3 ๐ถ3,V

๐ถV,3 ๐ถV,V

๐ถ3,3 = ๐ด3,3 โ‹… ๐ต3,3 + ๐ด3,V โ‹… ๐ตV,3๐ถ3,V = ๐ด3,3 โ‹… ๐ต3,V + ๐ด3,V โ‹… ๐ตV,V

๐ถV,3 = ๐ดV,3 โ‹… ๐ต3,3 + ๐ดV,V โ‹… ๐ตV,3๐ถV,V = ๐ดV,3 โ‹… ๐ต3,V + ๐ดV,V โ‹… ๐ตV,V

๐‘‡ ๐‘› โ‰ค 8๐‘‡ ๐‘›/2 +๐‘‚(๐‘›V )

๐‘‡ ๐‘› โ‰ค ๐‘‚(๐‘›6)

Strassenโ€˜s Algorithm

shows ๐œ” โ‰ค 2.81๐ด ๐ต ๐ถ

โ‹… =๐ด3,3 ๐ด3,V

๐ดV,3 ๐ดV,V

๐ต3,3 ๐ต3,V

๐ตV,3 ๐ตV,V

๐ถ3,3 ๐ถ3,V

๐ถV,3 ๐ถV,V

๐ถ3,3 = ๐‘€3 +๐‘€X โˆ’๐‘€๏ฟฝ + ๐‘€\

๐ถ3,V = ๐‘€6 + ๐‘€๏ฟฝ

๐ถV,3 = ๐‘€V +๐‘€X

๐ถV,V = ๐‘€3 โˆ’ ๐‘€V + ๐‘€6 +๐‘€๏ฟฝ

๐‘‡ ๐‘› โ‰ค 7๐‘‡ ๐‘›/2 +๐‘‚(๐‘›V )

๐‘‡ ๐‘› โ‰ค ๐‘‚ ๐‘›?@A๏ฟฝ \ = ๐‘‚(๐‘›V.๏ฟฝ๏ฟฝ\X)

๐‘€3 = ๐ด3,3 + ๐ดV,V โ‹… ๐ต3,3 + ๐ตV,V๐‘€V = ๐ดV,3 + ๐ดV,V โ‹… ๐ต3,3๐‘€6 = ๐ด3,3 โ‹… ๐ต3,V โˆ’ ๐ตV,V๐‘€X = ๐ดV,V โ‹… ๐ตV,3 โˆ’ ๐ต3,3๐‘€๏ฟฝ = ๐ด3,3 + ๐ด3,V โ‹… ๐ตV,V๐‘€๏ฟฝ = ๐ดV,3 โˆ’ ๐ด3,3 โ‹… ๐ต3,3 + ๐ต3,V๐‘€\ = ๐ด3,V โˆ’ ๐ดV,V โ‹… ๐ตV,3 + ๐ตV,V

Faster Matrix Multiplication

matrix of rank 1: outer product of two vectors

(๐‘–, ๐‘—)

(๐‘–Q , ๐‘˜Q)

(๐‘˜QQ , ๐‘—QQ)

tensor = 3-dimensional matrix

matrix multiplication tensor:๐‘›V rows/columns/...entries in {0,1}entry ๐‘‡ +,, , +๏ฟฝ ,/๏ฟฝ , /๏ฟฝ๏ฟฝ ,,๏ฟฝ๏ฟฝ = 1

iff ๐‘– = ๐‘–โ€ฒ and ๐‘— = ๐‘—QQ and ๐‘˜Q = ๐‘˜QQ

i.e. ๐ด+๏ฟฝ,/๏ฟฝ โ‹… ๐ต/๏ฟฝ๏ฟฝ ,,๏ฟฝ๏ฟฝ appears in ๐ถ+,,

matrix of rank ๐‘Ÿ: sum of ๐‘Ÿ rank-1-matrices

tensor of rank 1: outer product of three vectorstensor of rank ๐‘Ÿ: sum of ๐‘Ÿ rank-1-tensors

matrix rank is in P

tensor rank is not known to be in P

Faster Matrix Multiplication

(๐‘–, ๐‘—)

(๐‘–Q , ๐‘˜Q)

(๐‘˜QQ , ๐‘—QQ)

tensor = 3-dimensional matrix

matrix multiplication tensor:๐‘›V rows/columns/...entries in {0,1}entry ๐‘‡ +,, , +๏ฟฝ ,/๏ฟฝ , /๏ฟฝ๏ฟฝ ,,๏ฟฝ๏ฟฝ = 1

iff ๐‘– = ๐‘–โ€ฒ and ๐‘— = ๐‘—QQ and ๐‘˜Q = ๐‘˜QQ

i.e. ๐ด+๏ฟฝ,/๏ฟฝ โ‹… ๐ต/๏ฟฝ๏ฟฝ ,,๏ฟฝ๏ฟฝ appears in ๐ถ+,,

Strassen: rank of MM-tensor for ๐‘› = 2 is at most 7

any bound on rank of MM-tensor can be transformed into a MM-algorithm

thus search for faster MM-algorithms is a mathematical question

this is complete: one can find ๐œ”by analyzing tensor rank!

Outline

1) Relations to Subcubic Equivalences

2) Strassenโ€™s Algorithm

3) Sliding Window Hamming Distance

4) Node-Weighted Negative Triangle

5) Context-Free Grammars

Sliding Window Hamming Distance

given two strings: text ๐‘‡ of length ๐‘› and pattern ๐‘ƒ of length ๐‘š < ๐‘›

compute for each ๐‘– the Hamming distance of ๐‘ƒ and ๐‘‡[๐‘–. . ๐‘– + ๐‘š โˆ’ 1]

best known algorithm:

๐‘‚(๐‘› ๐‘špolylog๐‘›)

a b c b b c a ab b c a

b b c ab b c a

b b c ab b c a

23302

Thm: Sliding Window Hamming Distance has no๐‘‚(๐‘›G/VNI) algorithm or combinatorial ๐‘‚(๐‘›3.๏ฟฝNI) algorithm

unless the BMM-Hypothesis fails

โ‰ˆ ๐‘‚(๐‘›3.3๏ฟฝ)

โ‰ค ๐‘‚(๐‘›3.๏ฟฝ๏ฟฝ๏ฟฝ3)

Open Problem: get rid of โ€žcombinatorialโ€œor design improved algorithm using MM

[Indyk,Porat,Cliffordโ€˜09]

Sliding Window Hamming Distancegiven two strings: text ๐‘‡ of length ๐‘› and pattern ๐‘ƒ of length ๐‘š < ๐‘›compute for each ๐‘– the Hamming distance of ๐‘ƒ and ๐‘‡[๐‘–. . ๐‘– + ๐‘š โˆ’ 1]

1 0 01 1 10 1 1

1 1 01 0 10 1 1

โ‹… = ?

๐ด ๐ต

1 x x1 2 3x 2 3

1 1 y2 y 2y 3 3

pattern = concat rows:

$ $ $ $ $ $ 1 2 y $ 1 y 3 $ y 2 3 $ $ $ $ $ $

text = concat columns + padding:

1 x x 1 2 3 x 2 3

1 x x 1 2 3 x 2 3

alphabet: {1,2,...,๐‘›,x,y,$}

Sliding Window Hamming Distance

$ $ $ $ $ $ 1 2 y $ 1 y 3 $ y 2 3 $ $ $ $ $ $1 x x 1 2 3 x 2 3

1 x x 1 2 3 x 2 31 x x 1 2 3 x 2 3

1 x x 1 2 3 x 2 31 x x 1 2 3 x 2 3

1 x x 1 2 3 x 2 31 x x 1 2 3 x 2 3

1 x x 1 2 3 x 2 31 x x 1 2 3 x 2 3

1 0 01 1 10 1 1

1 1 01 0 10 1 1

โ‹… =1 1 01 1 11 1 1

put a 1 if there isat least one match

Sliding Window Hamming Distance

given Boolean ๐‘›ร—๐‘›-matrices ๐ด, ๐ต

we construct text+pattern of length ๐‘‚(๐‘›V) (in time ๐‘‚ ๐‘›V )

thus, an ๐‘‚(๐‘›G/VNI) algorithm for Sliding Window Hamming Distancewould yield an ๐‘‚(๐‘›GNVI) algorithm for BMM, contradicting BMM-Hypothesis

Thm: Sliding Window Hamming Distance has no๐‘‚(๐‘›G/VNI) algorithm or combinatorial ๐‘‚(๐‘›3.๏ฟฝNI) algorithm

unless the BMM-Hypothesis fails

and an ๐‘‚(๐‘›3.๏ฟฝNI) combinatorial algorithm for Sliding Window Hamming Dist.would yield an ๐‘‚(๐‘›6NVI) combinatorial algorithm for BMM

Outline

1) Relations to Subcubic Equivalences

2) Strassenโ€™s Algorithm

3) Sliding Window Hamming Distance

4) Node-Weighted Negative Triangle

5) Context-Free Grammars

Node-Weighted Negative Triangle

given a directed graph with weights ๐‘ค+,, on edges, is there a triangle ๐‘–, ๐‘—, ๐‘˜: ๐‘ค, ,+ + ๐‘ค+,/ + ๐‘ค/,, < 0?

(Edge-Weighted) Negative Triangle

Node-Weighted Negative Triangle

Triangle

given a directed graph with weights ๐‘ค+ on nodes, is there a triangle ๐‘–, ๐‘—, ๐‘˜: ๐‘ค+ +๐‘ค, + ๐‘ค/ < 0 ?

given an unweighted undirected graph,is there a triangle?

๐‘‚(๐‘›6)

๐‘‚(๐‘›G)

๐‘ค+ โ‰” โˆ’1

Node-Weighted Negative Triangle

(Edge-Weighted) Negative Triangle

Node-Weighted Negative Triangle

Triangle

๐‘‚(๐‘›6)

๐‘‚(๐‘›G)

find appropriate edge weights thatsimulate the given node weights:

set ๐‘ค+,, โ‰” (๐‘ค+ +๐‘ค, )/2

then for a triangle ๐‘–, ๐‘—, ๐‘˜:

๐‘ค,,+ + ๐‘ค+,/ + ๐‘ค/ ,, = ๐‘ค+ +๐‘ค, + ๐‘ค/

Node-Weighted Negative Triangle

(Edge-Weighted) Negative Triangle

Node-Weighted Negative Triangle

Triangle

๐‘‚(๐‘›6)

๐‘‚(๐‘›G)

๐‘‚(๐‘›G) [Czumaj,Lingasโ€™07]

actually for Node-Weighted Minimum Weight Triangle

Node-Weighted Minimum Weight Triangle

we can assume that the graph is tripartite:

๐บ:

๐‘‰

๐บQ:

๐‘‰3

๐‘ข

๐‘ฃ ๐‘‰V

๐‘‰6

๐‘ข3

๐‘ฃ3

๐‘ขV

๐‘ฃV ๐‘ข6

๐‘ฃ6

triangle ๐‘–, ๐‘—, ๐‘˜ triangle ๐‘–3,๐‘—V, ๐‘˜6โŸบ

Node-Weighted Minimum Weight Trianglegiven graph ๐บ = (๐‘‰, ๐ธ)with ๐‘‰ = ๐ผ โˆช ๐ฝ โˆช ๐พ and node weights ๐‘ค๏ฟฝ , compute minimum weight ๐‘ž s.t. there are ๐‘– โˆˆ ๐ผ, ๐‘— โˆˆ ๐ฝ, ๐‘˜ โˆˆ ๐พ with ๐‘–, ๐‘— , ๐‘—, ๐‘˜ , ๐‘˜, ๐‘– โˆˆ ๐ธ and ๐‘ค+ +๐‘ค, +๐‘ค/ = ๐‘ž

- parameter ๐‘ (=sufficiently large constant)- assume๐‘› โ‰” ๐ผ = ๐ฝ = ๐พ = ๐‘โ„“ for some โ„“ โˆˆ โ„•

(add isolated dummy vertices)

- assume that ๐ผ, ๐ฝ, ๐พ are sorted by weight

Node-Weighted Minimum Weight Trianglegiven graph ๐บ = (๐‘‰, ๐ธ)with ๐‘‰ = ๐ผ โˆช ๐ฝ โˆช ๐พ and node weights ๐‘ค๏ฟฝ , compute minimum weight ๐‘ž s.t. there are ๐‘– โˆˆ ๐ผ, ๐‘— โˆˆ ๐ฝ, ๐‘˜ โˆˆ ๐พ with ๐‘–, ๐‘— , ๐‘—, ๐‘˜ , ๐‘˜, ๐‘– โˆˆ ๐ธ and ๐‘ค+ +๐‘ค, +๐‘ค/ = ๐‘ž

- parameter ๐‘ (=sufficiently large constant)- assume๐‘› โ‰” ๐ผ = ๐ฝ = ๐พ = ๐‘โ„“ for some โ„“ โˆˆ โ„•

(add isolated dummy vertices)

- assume that ๐ผ, ๐ฝ, ๐พ are sorted by weight

ALG(G):

1) split ๐ผ = ๐ผ3 โˆชโ‹ฏโˆช ๐ผยฅ, ๐ฝ = ๐ฝ3 โˆชโ‹ฏโˆช ๐ฝยฅ, ๐พ = ๐พ3 โˆชโ‹ฏโˆช ๐พยฅ(in sorted order: max๐‘ค(๐ผn) โ‰ค min๐‘ค(๐ผnH3) and so on)

2) ๐‘… โ‰” ๐‘ฅ,๐‘ฆ, ๐‘ง โˆˆ 1, โ€ฆ , ๐‘ 6 ๐บ ๐ผn โˆช ๐ฝo โˆช ๐พp containsatriangle}

3) for each ๐‘ฅ,๐‘ฆ, ๐‘ง

run ALG(๐บ ๐ผn โˆช ๐ฝo โˆช ๐พp )

๐ผn

๐ผ ๐พp

๐พ

๐ฝo

๐ฝ

0) if ๐‘› = ๐‘‚(1) then solve in constant time

3) for each ๐‘ฅ,๐‘ฆ, ๐‘ง โˆˆ ๐‘… s.t. there is no ๐‘ฅQ,๐‘ฆQ, ๐‘งQ โˆˆ ๐‘… with ๐‘ฅQ < ๐‘ฅ, ๐‘ฆQ < ๐‘ฆ, ๐‘งQ < ๐‘ง

Node-Weighted Minimum Weight Triangle

Correctness:

3) for each ๐‘ฅ,๐‘ฆ, ๐‘ง โˆˆ ๐‘… s.t. there is no ๐‘ฅQ,๐‘ฆQ, ๐‘งQ โˆˆ ๐‘… with ๐‘ฅQ < ๐‘ฅ, ๐‘ฆQ < ๐‘ฆ, ๐‘งQ < ๐‘ง

if there is no triangle in ๐บ ๐ผn โˆช ๐ฝo โˆช ๐พp then we can ignore it

run ALG(๐บ ๐ผn โˆช ๐ฝo โˆช ๐พp )

if ๐‘ฅ,๐‘ฆ, ๐‘ง โˆˆ ๐‘… is dominated by ๐‘ฅQ,๐‘ฆQ, ๐‘งQ โˆˆ ๐‘…:

let ๐‘–, ๐‘—, ๐‘˜ be a triangle in ๐บ ๐ผn โˆช ๐ฝo โˆช ๐พp , and ๐‘–โ€ฒ, ๐‘—โ€ฒ, ๐‘˜โ€ฒ a triangle in ๐บ ๐ผn๏ฟฝ โˆช ๐ฝo๏ฟฝ โˆช ๐พp๏ฟฝ

then ๐‘ค+ + ๐‘ค, + ๐‘ค/ โ‰ฅ min๐‘ค(๐ผn) +min๐‘ค(๐ฝo)+ min๐‘ค(๐พp)

and ๐‘ค+๏ฟฝ + ๐‘ค,๏ฟฝ + ๐‘ค/๏ฟฝ โ‰ค max๐‘ค(๐ผn๏ฟฝ ) +max๐‘ค(๐ฝo๏ฟฝ ) + max๐‘ค(๐พp๏ฟฝ )

so we can safely ignore ๐บ ๐ผn โˆช ๐ฝo โˆช ๐พp

โ‰คโ‰ค โ‰ค

Node-Weighted Minimum Weight Trianglegiven graph ๐บ = (๐‘‰, ๐ธ)with ๐‘‰ = ๐ผ โˆช ๐ฝ โˆช ๐พ and node weights ๐‘ค๏ฟฝ , compute minimum weight ๐‘ž s.t. there are ๐‘– โˆˆ ๐ผ, ๐‘— โˆˆ ๐ฝ, ๐‘˜ โˆˆ ๐พ with ๐‘–, ๐‘— , ๐‘—, ๐‘˜ , ๐‘˜, ๐‘– โˆˆ ๐ธ and ๐‘ค+ +๐‘ค, +๐‘ค/ = ๐‘ž

- parameter ๐‘ (=sufficiently large constant)- assume๐‘› โ‰” ๐ผ = ๐ฝ = ๐พ = ๐‘โ„“ for some โ„“ โˆˆ โ„•

(add isolated dummy vertices)

- assume that ๐ผ, ๐ฝ, ๐พ are sorted by weight

ALG(G):

1) split ๐ผ = ๐ผ3 โˆชโ‹ฏโˆช ๐ผยฅ, ๐ฝ = ๐ฝ3 โˆชโ‹ฏโˆช ๐ฝยฅ, ๐พ = ๐พ3 โˆชโ‹ฏโˆช ๐พยฅ(in sorted order: max ๐ผn โ‰ค min ๐ผnH3 aso.)

2) ๐‘… โ‰” ๐‘ฅ,๐‘ฆ, ๐‘ง โˆˆ 1, โ€ฆ , ๐‘ 6 ๐บ ๐ผn โˆช ๐ฝo โˆช ๐พp containsatriangle}

3) for each ๐‘ฅ,๐‘ฆ, ๐‘ง โˆˆ ๐‘… s.t. there is no ๐‘ฅQ,๐‘ฆQ, ๐‘งQ โˆˆ ๐‘… with ๐‘ฅQ < ๐‘ฅ, ๐‘ฆQ < ๐‘ฆ, ๐‘งQ < ๐‘ง

run ALG(๐บ ๐ผn โˆช ๐ฝo โˆช ๐พp )

๐‘‚(๐‘6๐‘›G)

size ๐‘›/๐‘

how many iterations?

๐ผn

๐ผ ๐พp

๐พ

๐ฝo

๐ฝ

0) if ๐‘› = ๐‘‚(1) then solve in constant time

Node-Weighted Minimum Weight Triangle

How many iterations?

3) for each ๐‘ฅ,๐‘ฆ, ๐‘ง โˆˆ ๐‘… s.t. there is no ๐‘ฅQ,๐‘ฆQ, ๐‘งQ โˆˆ ๐‘… with ๐‘ฅQ < ๐‘ฅ, ๐‘ฆQ < ๐‘ฆ, ๐‘งQ < ๐‘ง

define ฮ”ยฎ,r โ‰” ๐‘ฅ, ๐‘ฆ, ๐‘ง โˆˆ 1,โ€ฆ ,๐‘ 6 ๐‘ฅ โˆ’ ๐‘ฆ = ๐‘Ÿand๐‘ฅ โˆ’ ๐‘ง = ๐‘ }

for ๐‘Ÿ, ๐‘  โˆˆ {โˆ’๐‘, โ€ฆ ,๐‘}

the sets ฮ”ยฎ,r cover 1, โ€ฆ ,๐‘ 6

line 3) applies to at most one (๐‘ฅ,๐‘ฆ, ๐‘ง)in ฮ”ยฎ,r for any ๐‘Ÿ, ๐‘ !

hence, there are at most (2๐‘)V= 4๐‘V recursive calls to ALG

= 1,1 โˆ’ ๐‘Ÿ,1 โˆ’ ๐‘  , 2,2 โˆ’ ๐‘Ÿ,2 โˆ’ ๐‘  , โ€ฆ , ๐‘,๐‘ โˆ’ ๐‘Ÿ, ๐‘ โˆ’ ๐‘  โˆฉ 1, โ€ฆ , ๐‘ 6

recursion: ๐‘‡ ๐‘› โ‰ค 4๐‘V โ‹… ๐‘‡ ๐‘›/๐‘ + ๐‘‚(๐‘6๐‘›G)

Node-Weighted Minimum Weight Trianglegiven graph ๐บ = (๐‘‰, ๐ธ)with ๐‘‰ = ๐ผ โˆช ๐ฝ โˆช ๐พ and node weights ๐‘ค๏ฟฝ , compute minimum weight ๐‘ž s.t. there are ๐‘– โˆˆ ๐ผ, ๐‘— โˆˆ ๐ฝ, ๐‘˜ โˆˆ ๐พ with ๐‘–, ๐‘— , ๐‘—, ๐‘˜ , ๐‘˜, ๐‘– โˆˆ ๐ธ and ๐‘ค+ +๐‘ค, +๐‘ค/ = ๐‘ž

- parameter ๐‘ (=sufficiently large constant)- assume๐‘› โ‰” ๐ผ = ๐ฝ = ๐พ = ๐‘โ„“ for some โ„“ โˆˆ โ„•

(add isolated dummy vertices)

- assume that ๐ผ, ๐ฝ, ๐พ are sorted by weight

ALG(G):

1) split ๐ผ = ๐ผ3 โˆชโ‹ฏโˆช ๐ผยฅ, ๐ฝ = ๐ฝ3 โˆชโ‹ฏโˆช ๐ฝยฅ, ๐พ = ๐พ3 โˆชโ‹ฏโˆช ๐พยฅ(in sorted order: max ๐ผn โ‰ค min ๐ผnH3 aso.)

2) ๐‘… โ‰” ๐‘ฅ,๐‘ฆ, ๐‘ง โˆˆ 1, โ€ฆ , ๐‘ 6 ๐บ ๐ผn โˆช ๐ฝo โˆช ๐พp containsatriangle}

3) for each ๐‘ฅ,๐‘ฆ, ๐‘ง โˆˆ ๐‘… s.t. there is no ๐‘ฅQ,๐‘ฆQ, ๐‘งQ โˆˆ ๐‘… with ๐‘ฅQ < ๐‘ฅ, ๐‘ฆQ < ๐‘ฆ, ๐‘งQ < ๐‘ง

run ALG(๐บ ๐ผn โˆช ๐ฝo โˆช ๐พp )

๐‘‚(๐‘6๐‘›G)

size ๐‘›/๐‘

๐ผn

๐ผ ๐พp

๐พ

๐ฝo

๐ฝ

0) if ๐‘› = ๐‘‚(1) then solve in constant time

recursion: ๐‘‡ ๐‘› โ‰ค 4๐‘V โ‹… ๐‘‡ ๐‘›/๐‘ + ๐‘‚(๐‘6๐‘›G)

Node-Weighted Minimum Weight Triangle

recursion: ๐‘‡ ๐‘› โ‰ค 4๐‘V โ‹… ๐‘‡ ๐‘›/๐‘ + ๐‘‚(๐‘6๐‘›G)

๐‘‡ ๐‘› โ‰ค 4๐‘V โ‹… ๐‘‡ ๐‘›/๐‘ + ๐›ผ๐‘6๐‘›G for some constant ๐›ผ

want to show: ๐‘‡ ๐‘› โ‰ค 2๐›ผ๐‘6๐‘›G

plug in: ๐‘‡ ๐‘› โ‰ค 4๐‘V โ‹… 2๐›ผ๐‘6(๐‘›/๐‘)G+๐›ผ๐‘6๐‘›G

= ๐›ผ๐‘6๐‘›G(1 + 8๐‘VNG)

assume ๐œ” > 2: โ‰ค 2๐›ผ๐‘6๐‘›G for a sufficiently large constant ๐‘

๐‘‡ ๐‘› โ‰ค ๐‘‚(๐‘›G)so we have:

(if ๐œ” = 2: show that ๐‘‡ ๐‘› โ‰ค 2๐›ผ๐‘6๐‘›GHI)

in total: ๐‘‡ ๐‘› โ‰ค ๐‘‚(๐‘›G + ๐‘›VHI) for any ๐œ€ > 0

In this lecture you learned that...

โ€ฆ(B)MM is useful for designing theoretically fast algorithms

- Exercise: k-Clique in ๐‘‚(๐‘›G//6)

no combinatorial ๐‘‚(๐‘›6NI)

- Exercise: MaxCut in ๐‘‚(2G1/6poly(๐‘›))- Node-Weighted Negative Triangle in ๐‘‚(๐‘›G)

โ€ฆBMM is an obstacle for practically fast / theoretically very fast algorithms

not faster than ๐‘‚(๐‘›V.6\6)

- Exercise: pattern matching with 2 patterns

- Sliding Window Hamming Distance

- Transitive Closure has no ๐‘‚(๐‘›GNI) / combinatorial ๐‘‚(๐‘›6NI) algorithm

- context-free grammar problems

top related