realweighted APSP Raphael Yuster University of Haifa 2 Permutations and matrix products This work consists of several algorithms and applications that involve the manipulation of sets of permutations via matrix multiplication ID: 575120
Download Presentation The PPT/PDF document "1 Efficient algorithms on sets of permut..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
1
Efficient algorithms on sets of permutations, dominance, and real-weighted APSP
Raphael Yuster
University of HaifaSlide2
2
Permutations and matrix products
This work consists of several algorithms and applications that involve the manipulation of sets of permutations via matrix multiplication techniques.
In this talk we shall only focus on one of these algorithms which, together with other ingredients implies a
sub-cubic APSP algorithm for arbitrary real weighted graphs
, where there are
not too many
distinct weights emanating from each vertex.
But before that:Slide3
3
An interesting open problem
Let P be a set of p permutations of S
n
.
P
2
= {
i
j
|
i
P
,
j
P
}
Task: compute
|
P
2
|
in less than trivial
p
2
n
time.
Example:
P
= {4231, 3124, 1243}
answer:
7
P
2
= {1234, 4123, 3241, 3421, 2314, 4213, 3142}
Say, e.g.,
p
=
n
, then computing it in
n
3
time is trivial.
With fast matrix
multiplication
we can show an
O
(
n
2.38
)
randomized
algorithm.
Can we solve it in
O
(
n
3-
)
deterministically
?Slide4
4
APSP
algorithm
All-Pairs Shortest Paths
n by n
distance
matrix
Input:
An edge-weighted
directed graph
G=
(
V
,
E
)
,
where
|V|=
n
(weights are arbitrary
reals
)
Output:
An
n
n
distance matrix.
Can
be solved in
:
O
(
n
3
(loglog
n
)
3
/ log
2
n
)
time
[Chan ‘07]
.Slide5
5
New result
APSP algorithm that is truly sub-cubic as long as theset of distinct weights emanating from each vertex is nottoo large (but still much larger than a constant).
For
v
V
, let
W
(
v
)
be the set of distinct weights of edges emanating from
v
and let
k(G)=maxv
|W
(v)|.
Our algorithm: sub-cubic when k(G
) < n0.338.
Note: this allows for up to n1.338
distinct weights.Slide6
6
Matrix multiplication exponents
M(a,
b
,
c
)
: “time” to multiply an
a
× b
matrix by a
b
×
c
matrix over an arbitrary field.ω(r,s,
t) : smallest exponent for which
M(n
r,n
s,nt
) = O(n
ω(r
,s,t
)) .ω(1,1,1) < 2.376 [Coppersmith-Winograd ‘90]
.μ : solution to
ω(1+μ ,1,1+μ) =3. μ > 0.338
.If k
(G) = n
ρ and ρ<
μ then the algorithm runs in time O(
n3-
γ/2+ρ/2
) where γ solves
ω(1+ ρ
,1,1+ γ)=3+ρ
- γ .
If ρ=0 then
γ=0.3165 implying vertex-weighted APSP in O(
n2.842). Slightly improves
O(n2.844
) [Chan ‘07] .Slide7
7
An interesting special caseof the APSP problem
A
B
17
23
Distance
product
2
5
10
20
30
20Slide8
8
Distance ProductsSlide9
9
A way to compute a distance product
Let A and
B
be two distance matrices, where:
each row of
A
has at most
k
=
n
ρ
distinct values
B
is arbitrary Then AB can be computed in time O
(n
ω(1+ ρ,1,1+
γ))
where γ solves ω
(1+ ρ,1,1+
γ)=3+ρ-
γ .
Proof: We reduce the problem to the problem of computing “permutation dominance” which, in turn, can be reduced to Boolean matrix multiplication.Slide10
10
For each row
u
of
A
, let
W
(
u
)={
w
u
,1
,…,
w
u
,
k
}
be the distinct values appearing in it.
Let
A
'
be the Boolean matrix of order
nk
×
n
indexed by the row set
[
k
] × [
n
]
and the column set
[
n
].We set
A'((j,u
),v) = 1 iff A(u,v)=
wu,
j .“Example”:
n=4, k
=2Slide11
3
=(3 2 1 4)
11
Let
u
be a permutation so that
u
(
i
) <
u
(
j
)
implies
B
(
i
,
u
)
B
(
j
,
u
)
. We can construct
1
,
...
,
n
in
O
(
n
2
log
n
)
time by sorting each column of
B.Let B' be the Boolean matrix of order n ×
ns indexed by the row set [n] and the column set [s] × [n
]
. We set
B
'(
u
,(
j
,
v
))=1
iff
v
(
u
)
[1+(
j
-1)(
n
/
s
) , … ,
jn
/
s
]
.
“Example”:
n
=4
,
s
=2
(we will actually choose
s
=
n
γ
)Slide12
we compute
C'=A'B
' in O(nω
(1+
ρ
,1,1+
γ
)
)
time.
We can deduce
D
=
AB from C'.Fixing
u and
v, we show how to compute D(
u,v) in
O(k(
s+n
/s)) time, and hence D
is computed in O(
n2k(s+n/s)) =
O(n
3+ρ-γ
) = O(
nω(1+ ρ
,1,1+γ)) time.
12Slide13
For each
i=1,…,k, let ji
be the smallest index so thatC((i,
u
),(
j
i
,
v
))=1
(if no such index exists, set
j
i
=0
).
If ji 0, we know that we have at least one index
z so that
A'((i,
u),z)=1 and
B'(z
,(ji,
v))=1.This means that
v(
z) [1+(ji - 1)(n/
s) , … , j
i n/
s].We wish to locate that
zi for which
v(z)
is minimal. We use v to locate
zi in O
(n/s
) time.We know that A
(u,z
i)+B(
zi,v
) is the minimum sum whenever the first term has weight wu
,i.
Taking the minimum of A(u
,zi)+
B(zi,v) ranging over all plausible i we obtain D
(u,
v).
13Slide14
14
3
=(3 2 1 4)
j
1
=2
Belongs to block 2:
j
1
=2
Belongs to
block 1:
j
2
=1
3
(1),
3
(4) {3,4}
z
=1
z
=4
relevant
z
1
=1
7+8=15
j
2
=1
3
(2),
3
(3
)
{1,2}
z
=2
z
=3
relevant
z
2
=3
1+4=5Slide15
15
From distance product to APSP
G=(V,
E
,
w
)
is a weighted digraph with
n
vertices
For
v
V, W(v) are the emanating weights. |W(
v)|
k.
t - a parameter (to be chosen later).
c(u
,v) min. # of edges on shortest path from
u to v.
di(
u,v) shortest distance from u to v using at most i edges. Clearly, d(u
,v)=d
n-1(
u,v).
d1(u
,v)=w
(u,v
).
Di - the matrix recording all the values di
(u,
v). Thus, D
1 is our input.Notice : D
i = D
1 Di-1
.Slide16
16
From distance product to APSP
Each row of D1 has at most k
=
n
ρ
distinct values.
Thus,
D
i
is computed from
D
1
Di-1 inO(n
3+ρ
-γ) = O
(nω
(1+ ρ,1,1+γ
)) time.Hence
Dt is computed in O
( t n3+
ρ-γ ) .We already know that Dt(
u,v
)=D(u
,v) for all pairs with c
(u,v
) t.
We need to worry about pairs for which c(
u,v) >
t.For this, we shall use the bridging sets
technique of [Zwick ‘02] .Slide17
17
From distance product to APSP
A set of vertices B is a t-bridging set if for each
u
,
v
with
>
c
(
u
,
v
) >
t, there exists a shortest path p ={u=u
0,
u1,…,u
s=v}
realizing d1.5t
(u,v
) where some vertex ui
is from B and i
(s-t … t).
Easy to show: a random
set B of size(
n log n /
t) is a t-bridging set. (Zwick has shown how to find such a
B deterministically in O
(n2.5)
time).Having found a t-bridging set
B, we compute a matrix which is (better than) D1.5
t as follows:
0
s-t
t
s
u
vSlide18
18
From distance product to APSP
Time: O(n3
/
t
)
(straightforward product).
W
e now have
D
(
u
,
v
)
for all pairs with c(u,v)
1.5
t.Repeated squaring
O(log n) time we get the final
D.Choosing
t= n
γ/2-ρ
/2 we obtain that:
The overall running time is O(n3- γ/2+ρ/2
) as claimed .
D
t
(
B
)
D
t
T
(
B
)
D
1.5
t
Slide19
19
Thanks