1
Finding the smallest H-subgraph in real weighted graphs and
related problems
Raphael Yuster
University of Haifa
Joint work with:Virginia Vassilevska, Ryan Williams
CMU
2
The min H-subgraph problem
Input: A vertex-weighted graph G=(V,E), where |E|=m and |V|=n.
Output: An (induced) H-subgraph with minimum total weight, if exists.
2/3
1/23/4
1/3
1/2 H = K3
real vertex weights
Similarly define the edge-weighted version.
3
The min H-subgraph problem
• We work in the addition-comparison model.
• All results apply to directed graphs as well.
• The naïve algorithm solves themin H-subgraph problem in O(nh) time.
• The goal: reduce the exponent (problem is conjectured to be not fixed parameter tractable already in the unweighted case).
• Case h=3 (triangles) studied in [VW – STOC06] who gave the first sub-cubic algorithm.
4
Results – the vertex weighted case
For fixed H with h vertices, a minimum weight (induced) H-subgraph can be found in O(nt(ω,h)) time.
ω < 2.376 [Coppersmith-Winograd ’90] is the exponent of fast square matrix multiplication(possibly ω = 2+on(1) someday).
The exponent t(ω,h) in our theorem is obtained by solving a small integer program.
5
t(ω,h) : definition
21
22
2
111
1
,min),(
22
:)(min
2)3(,
2max)(
4
24:max
ssht
hbbh
bss
bhh
bhbhbs
bbhs
bhbNbb
t(ω,h) → 3h/(6-ω)≤ 0.828h
6
ht(ω,h)unweightedω=2.376ω=2.376
unweighted
32+1)/4-ω(ω2.6162.376
4ω+1ω+13.3763.376
5ω+2ω+24.3764.376
64+2)/4-ω(2ω5.2324.752
74+3)/4-ω(2ω+15.8485.752
82ω+22ω+26.7526.752
92ω+33ω7.7527.128
106+4)/4-ω(3ω+18.4638.128
113ω+26+5)/4-ω) (ω=2(
3ω+29.1288.5) ω=2(
9.1288) ω=2(
Improves (ω+3)/2
VW-STOC06
7
Proof – the vertex weighted case
• Assume H=Kh
• G=(V,E) V={1,2,…,n} w: V → R
• For a positive integer t let St be the set of allt-subsets of V sorted by their total weight.|St| < nt and can be sorted in O(nt log n) time.
• Suppose h=a+b+c where a,b,c are positive integers.
• Create two 0-1 matricesM1=M1(G,a,b) M2=M2(G,b,c)
8
Proof – the vertex weighted case
The matrix M1
Sa
Sb (sorted)
X
Y1: X UY = Ka+b
0: otherwise
9
Proof – the vertex weighted case
The matrix M2
Sb
(sorted)
Sc
Y
Z1: Y UZ = Kb+c
0: otherwise
10
Proof – the vertex weighted case
• Compute M3=M1M2
• Suppose (i) M3(X,Z) > 0 (ii) X U Z induces a Ka+c
YSb so that M1(X,Y)=1 M2(Y,Z)=1hence X U Y U Z is a Kh
• Y is called a witness for the pair (X,Z).If Y is the minimal witness in the sorted Sb thenw(X)+w(Y)+w(Z) is the weight of the smallest Kh containing X U Z.
11
Proof – the vertex weighted case
• Let W be the minimal witness matrix of the product of two 0-1 matrices C=AB.
W[i,j]=0 : C[i,j]=0k : A[i,k]=B[k,j]=1, A[i.k’]B[k’,j]=0 k’<k
•Computing W for dimensions n1,n2,n3 denotedf(n1,n2,n3)
•Need to prove:
mina+b+c=h f(na,nb,nc) = O(nt(ω,h))
12
Computing minimal witnesses
• Computing a matrix of witnesses can be done in essentially the same time needed to perform the product ([Seidel ’95], [Alon+Naor ’96]).
• Problem: Gives no clue on the minimum witness.
• [Kowaluk and Lingas ’05] f(n,n,n) = O(n2+1/(4-ω))They considered a different problem:
computing all pairs lca in a dag
• This already gives the case t(ω,3)=2+1/(4-ω)
• We need to extend their result to other dimensions and optimize upon the choices of a,b,c.
13
na
… nb
nb
nμ nμ
nc
nμ
nμ
...A1 Ap
B1
Bp
…...
a+b+c=h 0< μ≤b
μ split
Ci = AiBi i=1,…p
C=AB= ∑Ci
14
• Let r be the smallest index for which Cr[i,j]>0
• If r does not exist then W[i,j]=0.
• Otherwise let k be the smallest index forwhich Ar[i,k]=Br[k,j]=1.
• W[i,j] = (r-1)nμ+k.
Computing W[i,j]
15
Computing W
Computing a single witness: O(p+nμ)
Computing all witnesses: O(na+c(p +nμ))
Computing a single Ci: O(na-μnc-μnω μ)
Computing all Ci: O(p(na-μnc-μnω μ))
Overall running time
O(na+c(p+nμ) + p(na+c+(ω-2)μ)) =
O(nh-(3- ω) μ+nh-b+μ)
16
Computing W
•For h=3 take a=1 b=1 c=1 μ=1/(4-ω)
•For h=4 take a=1 b=2 c=1 μ=1
•For h=5 take a=2 b=2 c=1 μ=1
•For h=7 take a=2 b=3 c=2 μ=3/(4-ω)
•For h=9 take a=3 b=4 c=2 μ=2
17
Additional features
• Number of comparisons is pretty small:h=3 n log n + mh=4 n2 log n + mh=5 n2 log n + mnh=6 n2 log n + m2
• Can solve the decision problem:Given a real interval I R is there an (induced)H-subgraph whose weight is within I ?
Use binary search within the matrices C1, …,Cp
Running time increases only by log n factor.
18
Additional features
• Can find smallest K2,k in O(n2+1/(4-ω)) < O(n2.616) time.
• Result is meaningful also when the weights are large integers:
β(G,H) the H edge-covering numbermaximum number of edges incident with H-subgraph
β(G,K3)=82
3
4
34
1
1
19
Sparse graphsA triangle can be found in O(m2ω/(ω+1)) < O(m1.41) time
[Alon+Y+Zwick ’97]
• Let Δ be a parameter.
• Vertices in Y having degree > Δ. |Y| < 2m/Δ
• Triangles with vertex in V-Y examined in O(mΔ) time.
• Smallest triangle inside Y found in O(|Y|2+1/(4-ω)) time.
• Overall: O(mΔ+(m/Δ)2+1/(4-ω))
• Optimizing on Δ: O(m(18-4ω)/(13-3ω)) < O(m1.45)
Finding the smallest weighted triangle
20
Edge weighted graphs
•H has k vertices.
•Color V(G) with k colors, randomly.
•Colorful H sometimes easier to find.
•Probability of being colorful: k!/kk > e-k
•Can be derandomized.
The color coding method [Alon+Y+Zwick ’95]
21
Edge weighted graphs
• A and B two compatible matrices in R U ∞
• The distance product D=AB defined by
D[i,j] = mink A[i,k]+B[k,j]
• If A and B are square matrices of order n, then D can be computed in O(n3) time.
• [Chan ’05] Only O(n3/log n) time needed!
• Consequence: Min H-subgraph in O(nk/log n) time.
Distance products
22
Edge weighted graphs
A minimum weight k-cycle can be found, w.h.p., in 2O(k) n3/log n time.For k=o(log log n) this is sub-cubic.
• For each pair u,v find the shortest colorful path of length k-1 connecting them in 2O(k) n3/log n time.
• Assume k is a power of 2 (we use recursion).
• Let C1 be a set of k/2 colors. C2 = C-C1.
• Vi – the vertices colored with a color from Ci.
• Gi – the subgraph induced by Vi.
23
Edge weighted graphs• Recursively find, for each pair in Vi, a colorful
path in Gi of length k/2-1. Record the results in matrices A1 and A2.
• B – the matrix with rows indexed by V1 and columns indexed by V2. B[u,v]=w(u,v).
• The distance product DC1,C2=A1 B A2 gives for each pair of vertices, the shortest colorful path of length k-1 where the first k/2 vertices are colored from C1 and the last k/2 vertices are colored from C2.
24
Edge weighted graphs
• By considering all choices for (C1,C2) (less than 2k choices) we obtain an nn matrix D where D[u,v] is the shortest colorful path of length k-1 between u and v.
• The number of distance products using this approach satisfies t(k) ≤ 2kt(k/2).Thus, t(k) = 2O(k).
• Each product costs O(n3/log n).
25
Chromatic subgraphs
• G=(V,E) an edge-colored graph (number of colors is arbitrary).
We consider
• The monochromatic H-subgraph problem
• The rainbow H-subgraph problem
• Both problems are not easier than the (uncolored) H-subgraph existence problem.
• Are they also not harder?
26
Rainbow subgraphs• We use color reduction.
• Suppose H has t edges.
• f : C → {1,2,…,t}. We now have only t colors.
• A rainbow H now is also originally rainbow.
• f random – an original rainbow H will remain rainbow after reduction with probability t!/tt.
• Do this 2O(t) times and it will happen w.h.p. at least once.
• Can be derandomized. Cost is only O(log n) factor.
27
Rainbow subgraphs• When we have only t colors, same algorithm for
the uncolored version can be used to detect a monochromatic H.
Example K6
28
Monochromatic subgraphsFor any connected fixed graph H with 3k+j vertices (j=0,1,2), a monochromatic H can be detected in O(nωk+j), except of H=K3.
Example K6
•Running time identical to (uncolored) detection.
•Triangles can be found only in O(n(3+ω)/2) < o(n2.688).