An Improved Combinatorial Algorithm for Boolean Matrix Multiplication

Introduction
Triangle Detection Algorithm
Conclusion
An Improved Combinatorial Algorithm for Boolean
Matrix Multiplication
Huacheng Yu
Stanford University
June 8, 2016
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Introduction
Boolean Matrix Multiplication (Boolean MM or BMM):

1
0

1

 ..
.
0
1
1
..
.
···
···
···
..
.
1
0
1
..
.
1
0
···
0
 
0
 1
 
 1
·
  ..
 .
Huacheng Yu
0
1
0
..
.
···
···
···
..
.

1
0

0
=
.. 
.
1 1
···
1
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Introduction
Boolean Matrix Multiplication (Boolean MM or BMM):

1 0
0 1

ai,1 ai,2

 ..
..
.
.
1
0
 
··· 1
0
1
··· 0 
 
 1
· · · ai,n
·
 .
.
..
.
. .   ..
··· 0
1
Huacheng Yu
b1,j
b2,j
b3,j
..
.
···
···
···
..
.
bn,j · · ·

1 1 ··· 1
1 1 · · · 0


1 ci,j · · · 1


. .

.
.
 .. ..
. . .. 
0 0 ··· 1
Wn
k=1 (ai,k ∧ bk,j )

1
0

0
=
.. 
.
1

An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Introduction
Boolean Matrix Multiplication (Boolean MM or BMM):
ci,j =
n
_
(ai,k ∧ bk,j )
k=1
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Introduction
Boolean Matrix Multiplication (Boolean MM or BMM):
n
_
ci,j =
(ai,k ∧ bk,j )
k=1
No harder than Integer MM:
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Introduction
Boolean Matrix Multiplication (Boolean MM or BMM):
n
_
ci,j =
(ai,k ∧ bk,j )
k=1
No harder than Integer MM:
Strassen [1969]: O(n2.81 )
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Introduction
Boolean Matrix Multiplication (Boolean MM or BMM):
n
_
ci,j =
(ai,k ∧ bk,j )
k=1
No harder than Integer MM:
Strassen [1969]: O(n2.81 )
Coppersmith-Winograd [1990]: O(n2.376 )
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Introduction
Boolean Matrix Multiplication (Boolean MM or BMM):
n
_
ci,j =
(ai,k ∧ bk,j )
k=1
No harder than Integer MM:
Strassen [1969]: O(n2.81 )
Coppersmith-Winograd [1990]: O(n2.376 )
Vassilevska Williams [2012], Le Gall [2014]: O(n2.373 )
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Introduction
Boolean Matrix Multiplication (Boolean MM or BMM):
n
_
ci,j =
(ai,k ∧ bk,j )
k=1
No harder than Integer MM:
Strassen [1969]: O(n2.81 )
Coppersmith-Winograd [1990]: O(n2.376 )
Vassilevska Williams [2012], Le Gall [2014]: O(n2.373 )
Algebraic algorithms!
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Introduction
Boolean Matrix Multiplication (Boolean MM or BMM):
ci,j =
n
_
(ai,k ∧ bk,j )
k=1
Combinatorial algorithms!
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Introduction
Boolean Matrix Multiplication (Boolean MM or BMM):
ci,j =
n
_
(ai,k ∧ bk,j )
k=1
Combinatorial algorithms!
Four Russians [1970]: O(n3 / log2 n)
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Introduction
Boolean Matrix Multiplication (Boolean MM or BMM):
ci,j =
n
_
(ai,k ∧ bk,j )
k=1
Combinatorial algorithms!
Four Russians [1970]: O(n3 / log2 n)
Bansal-Williams [2009]: Ô(n3 / log2.25 n)
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Introduction
Boolean Matrix Multiplication (Boolean MM or BMM):
ci,j =
n
_
(ai,k ∧ bk,j )
k=1
Combinatorial algorithms!
Four Russians [1970]: O(n3 / log2 n)
Bansal-Williams [2009]: Ô(n3 / log2.25 n)
Chan [2015]: Ô(n3 / log3 n)
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Introduction
Boolean Matrix Multiplication (Boolean MM or BMM):
ci,j =
n
_
(ai,k ∧ bk,j )
k=1
Combinatorial algorithms!
Four Russians [1970]: O(n3 / log2 n)
Bansal-Williams [2009]: Ô(n3 / log2.25 n)
Chan [2015]: Ô(n3 / log3 n)
This paper [2015]: Ô(n3 / log4 n)
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Algebraic vs Combinatorial
On Boolean MM:
Algebraic Algorithms
Combinatorial Algorithms
Asymptotically faster
Asymptotically slower
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Algebraic vs Combinatorial
On Boolean MM:
Algebraic Algorithms
Combinatorial Algorithms
Asymptotically faster
Asymptotically slower
Difficult to implement
slow in practice
Very simple
fast in practice
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Algebraic vs Combinatorial
On Boolean MM:
Algebraic Algorithms
Combinatorial Algorithms
Asymptotically faster
Asymptotically slower
Difficult to implement
slow in practice
Very simple
fast in practice
Require similar algebraic
structure to generalize
Generalizable in a different way
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Combinatorial Algorithms
Combinatorial algorithms can:
solve edit distance in o(n2 )
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Combinatorial Algorithms
Combinatorial algorithms can:
solve edit distance in o(n2 )
solve sequence alignment in o(n2 )
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Combinatorial Algorithms
Combinatorial algorithms can:
solve edit distance in o(n2 )
solve sequence alignment in o(n2 )
multiply n × Ô(log3 n) and Ô(log3 n) × n Boolean matrices
in O(n2 ) time
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Combinatorial Algorithms
Combinatorial algorithms can:
solve edit distance in o(n2 )
solve sequence alignment in o(n2 )
multiply n × Ô(log3 n) and Ô(log3 n) × n Boolean matrices
in O(n2 ) time
multiply n × n and n × Ô(log3 n) Boolean matrices in O(n2 )
time
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Combinatorial Algorithms
Combinatorial algorithms can:
solve edit distance in o(n2 )
solve sequence alignment in o(n2 )
multiply n × Ô(log3 n) and Ô(log3 n) × n Boolean matrices
in O(n2 ) time
multiply n × n and n × Ô(log3 n) Boolean matrices in O(n2 )
time
preprocess a Boolean matrix A, answer queries Ax in
n2 / log2 n
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Combinatorial Algorithms
Combinatorial algorithms can:
solve edit distance in o(n2 )
solve sequence alignment in o(n2 )
multiply n × Ô(log3 n) and Ô(log3 n) × n Boolean matrices
in O(n2 ) time
multiply n × n and n × Ô(log3 n) Boolean matrices in O(n2 )
time
preprocess a Boolean matrix A, answer queries Ax in
n2 / log2 n
Larsen-Williams [2016]: n2 /2Ω(
algorithm)
Huacheng Yu
√
log n)
(by a half-algebraic
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Combinatorial Algorithms
Combinatorial algorithms can:
solve edit distance in o(n2 )
solve sequence alignment in o(n2 )
multiply n × Ô(log3 n) and Ô(log3 n) × n Boolean matrices
in O(n2 ) time
multiply n × n and n × Ô(log3 n) Boolean matrices in O(n2 )
time
preprocess a Boolean matrix A, answer queries Ax in
n2 / log2 n
√
Larsen-Williams [2016]: n2 /2Ω( log n) (by a half-algebraic
algorithm) (randomized, heavy preprocessing or amortized
time)
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Triangle Detection
Triangle detection: given an n-node graph, does it contain a
triangle (3-clique or 3-cycle)?
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Triangle Detection
Triangle detection: given an n-node graph, does it contain a
triangle (3-clique or 3-cycle)?
Vassilevska Williams and Williams [2010] proved:
Triangle detection
Huacheng Yu
“sub-cubic”
Boolean MM
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Triangle Detection
Triangle detection: given an n-node graph, does it contain a
triangle (3-clique or 3-cycle)?
Vassilevska Williams and Williams [2010] proved:
Triangle detection
O(n3 /g(n))
Huacheng Yu
“sub-cubic”
combinatorial
Boolean MM
O(n3 /g(n1/3 ))
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Main Result
Our main theorem:
Theorem
Given a graph G on n vertices
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Main Result
Our main theorem:
Theorem
Given a graph G on n vertices, we can detect if there is a triangle
in G using a combinatorial algorithm in Ô(n3 / log4 n) time.
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Main Result
Our main theorem:
Theorem
Given a graph G on n vertices, we can detect if there is a triangle
in G using a combinatorial algorithm in Ô(n3 / log4 n) time.
A general framework for triangle detection:
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Main Result
Our main theorem:
Theorem
Given a graph G on n vertices, we can detect if there is a triangle
in G using a combinatorial algorithm in Ô(n3 / log4 n) time.
A general framework for triangle detection:
“Theorem”
If there is an algorithm that takes a graph and can“efficiently” find
and solve triangle detection on a “large” subgraph
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Main Result
Our main theorem:
Theorem
Given a graph G on n vertices, we can detect if there is a triangle
in G using a combinatorial algorithm in Ô(n3 / log4 n) time.
A general framework for triangle detection:
“Theorem”
If there is an algorithm that takes a graph and can“efficiently” find
and solve triangle detection on a “large” subgraph, then triangle
detection is “easy” in general.
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Triangle Detection Algorithm
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Preliminaries
Wish to detect if a graph G contains a triangle.
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Preliminaries
Wish to detect if a graph G contains a triangle.
Observation: can assume G is tripartite.
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Preliminaries
Wish to detect if a graph G contains a triangle.
Observation: can assume G is tripartite.
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Preliminaries
Wish to detect if a graph G contains a triangle.
Observation: can assume G is tripartite.
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Preliminaries
Wish to detect if a graph G contains a triangle.
Observation: can assume G is tripartite.
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Preliminaries
Wish to detect if a graph G contains a triangle.
Observation: can assume G is tripartite.
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Preliminaries
Wish to detect if a graph G contains a triangle.
Observation: can assume G is tripartite.
i
j
i
j
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Preliminaries
Wish to detect if a tripartite graph G = (A ∪ B ∪ C, E) contains a
triangle.
Observation: can assume G is tripartite.
i
j
i
j
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Preliminaries
Wish to detect if a tripartite graph G = (A ∪ B ∪ C, E) contains a
triangle.
One naı̈ve approach:
for v ∈ A, check edge between its
neighbours
dv,B
v dv,C
B
C
A
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Preliminaries
Wish to detect if a tripartite graph G = (A ∪ B ∪ C, E) contains a
triangle.
One naı̈ve approach:
for v ∈ A, check edge between its
neighbours
dv,B
spend dv,B dv,C time
v dv,C
B
C
A
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Preliminaries
Wish to detect if a tripartite graph G = (A ∪ B ∪ C, E) contains a
triangle.
One naı̈ve approach:
for v ∈ A, check edge between its
neighbours
dv,B
spend dv,B dv,C time
v dv,C
fast if dv,B dv,C small on average
B
C
A
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Preliminaries
Wish to detect if a tripartite graph G = (A ∪ B ∪ C, E) contains a
triangle.
One naı̈ve approach:
for v ∈ A, check edge between its
neighbours
dv,B
spend dv,B dv,C time
v dv,C
fast if dv,B dv,C small on average
otherwise can find large “non-edge
area” between B and C
B
C
A
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Preliminaries
Wish to detect if a tripartite graph G = (A ∪ B ∪ C, E) contains a
triangle.
One naı̈ve approach:
for v ∈ A, check edge between its
neighbours
dv,B
spend dv,B dv,C time
v dv,C
fast if dv,B dv,C small on average
otherwise can find large “non-edge
area” between B and C
recursion!
B
C
(also used in Chan’s
algorithm)
A
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Sparse Case
The sparse case: dv,B dv,C 6 Ô(n2 / log2 n) for every v ∈ A.
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Sparse Case
The sparse case: dv,B dv,C 6 Ô(n2 / log2 n) for every v ∈ A.
Solvable in time Ô(n3 / log4 n).
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Sparse Case
The sparse case: dv,B dv,C 6 Ô(n2 / log2 n) for every v ∈ A.
Solvable in time Ô(n3 / log4 n).
B
C
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Sparse Case
The sparse case: dv,B dv,C 6 Ô(n2 / log2 n) for every v ∈ A.
Solvable in time Ô(n3 / log4 n).
B
C
log3 n
log3 n
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Sparse Case
The sparse case: dv,B dv,C 6 Ô(n2 / log2 n) for every v ∈ A.
Solvable in time Ô(n3 / log4 n).
B
C
6
0.1 log n
log log n
log3 n
log3 n
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Sparse Case
The sparse case: dv,B dv,C 6 Ô(n2 / log2 n) for every v ∈ A.
Solvable in time Ô(n3 / log4 n).
B
C
6
0.1 log n
log log n
log3 n
∃ edg
e?
Huacheng Yu
log3 n
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Sparse Case
The sparse case: dv,B dv,C 6 Ô(n2 / log2 n) for every v ∈ A.
Solvable in time Ô(n3 / log4 n).
B
C
6
0.1 log n
log log n
log3 n
∃ edg
e?
Huacheng Yu
log3 n
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Sparse Case
The sparse case: dv,B dv,C 6 Ô(n2 / log2 n) for every v ∈ A.
Solvable in time Ô(n3 / log4 n).
B
C
6
0.1 log n
log log n
log3 n
∃ edg
e?
log3 n
Preprocessing: n2 (log3 n)0.2 log n/ log log n = O(n2.6 ).
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Sparse Case
The sparse case: dv,B dv,C 6 Ô(n2 / log2 n) for every v ∈ A.
Solvable in time Ô(n3 / log4 n).
Preprocessing: O(n2.6 ).
B
C
6
0.1 log n
log log n
log3 n
∃ edg
e?
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Sparse Case
The sparse case: dv,B dv,C 6 Ô(n2 / log2 n) for every v ∈ A.
Solvable in time Ô(n3 / log4 n).
Preprocessing: O(n2.6 ).
B
for v ∈ A, partition its
neighbourhood into small
subsets within each block
C
6
0.1 log n
log log n
log3 n
∃ edg
e?
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Sparse Case
The sparse case: dv,B dv,C 6 Ô(n2 / log2 n) for every v ∈ A.
Solvable in time Ô(n3 / log4 n).
Preprocessing: O(n2.6 ).
B
for v ∈ A, partition its
neighbourhood into small
subsets within each block
C
6
0.1 log n
log log n
log3 n
∃ edg
e?
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Sparse Case
The sparse case: dv,B dv,C 6 Ô(n2 / log2 n) for every v ∈ A.
Solvable in time Ô(n3 / log4 n).
Preprocessing: O(n2.6 ).
B
for v ∈ A, partition its
neighbourhood into small
subsets within each block
check each pair of small
subsets by lookup table
Huacheng Yu
C
6
0.1 log n
log log n
log3 n
∃ edg
e?
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Sparse Case
The sparse case: dv,B dv,C 6 Ô(n2 / log2 n) for every v ∈ A.
Solvable in time Ô(n3 / log4 n).
Preprocessing: O(n2.6 ).
B
for v ∈ A, partition its
neighbourhood into small
subsets within each block
C
6
0.1 log n
log log n
log3 n
check each pair of small
subsets by lookup table
∃ edg
e?
Ô(dv,B /log n + n/ log3 n),
Ô(dv,C /log n + n/ log3 n)
small subsets respectively
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Sparse Case
The sparse case: dv,B dv,C 6 Ô(n2 / log2 n) for every v ∈ A.
Solvable in time Ô(n3 / log4 n).
Preprocessing: O(n2.6 ).
B
for v ∈ A, partition its
neighbourhood into small
subsets within each block
C
6
0.1 log n
log log n
log3 n
check each pair of small
subsets by lookup table
∃ edg
e?
Ô(dv,B /log n + n/ log3 n),
Ô(dv,C /log n + n/ log3 n)
small subsets respectively
Spend Ô(n3 / log4 n) in total.
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Algorithm
log n
Given an n-node tripartite graph, fix ∆ = 100(log
.
log n)2
√
√
Step 0: If |B| < n or |C| < n, use exhaustive search;
Step 1: If for every v ∈ A, dv,B dv,C 6 |B||C|/∆2 , use the sparse
case algorithm;
Step 2: Otherwise, find a v ∈ A such that dv,B dv,C > |B||C|/∆2 ;
let Bv [resp. Cv ] be v’s neighbourhood in B [resp. C];
Step 3: Check all pairs in Bv × Cv for an edge;
Step 4: If |Bv |/|B| > |Cv |/|C|,
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Algorithm
log n
Given an n-node tripartite graph, fix ∆ = 100(log
.
log n)2
√
√
Step 0: If |B| < n or |C| < n, use exhaustive search;
Step 1: If for every v ∈ A, dv,B dv,C 6 |B||C|/∆2 , use the sparse
case algorithm;
Step 2: Otherwise, find a v ∈ A such that dv,B dv,C > |B||C|/∆2 ;
let Bv [resp. Cv ] be v’s neighbourhood in B [resp. C];
Step 3: Check all pairs in Bv × Cv for an edge;
Step 4: If |Bv |/|B| > |Cv |/|C|,
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Algorithm
log n
Given an n-node tripartite graph, fix ∆ = 100(log
.
log n)2
√
√
Step 0: If |B| < n or |C| < n, use exhaustive search;
Step 1: If for every v ∈ A, dv,B dv,C 6 |B||C|/∆2 , use the sparse
case algorithm;
Step 2: Otherwise, find a v ∈ A such that dv,B dv,C > |B||C|/∆2 ;
let Bv [resp. Cv ] be v’s neighbourhood in B [resp. C];
Step 3: Check all pairs in Bv × Cv for an edge;
Step 4: If |Bv |/|B| > |Cv |/|C|,
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Algorithm
log n
Given an n-node tripartite graph, fix ∆ = 100(log
.
log n)2
√
√
Step 0: If |B| < n or |C| < n, use exhaustive search;
Step 1: If for every v ∈ A, dv,B dv,C 6 |B||C|/∆2 , use the sparse
case algorithm;
Step 2: Otherwise, find a v ∈ A such that dv,B dv,C > |B||C|/∆2 ;
let Bv [resp. Cv ] be v’s neighbourhood in B [resp. C];
Step 3: Check all pairs in Bv × Cv for an edge;
Step 4: If |Bv |/|B| > |Cv |/|C|,
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Algorithm
log n
Given an n-node tripartite graph, fix ∆ = 100(log
.
log n)2
√
√
Step 0: If |B| < n or |C| < n, use exhaustive search;
Step 1: If for every v ∈ A, dv,B dv,C 6 |B||C|/∆2 , use the sparse
case algorithm;
Step 2: Otherwise, find a v ∈ A such that dv,B dv,C > |B||C|/∆2 ;
let Bv [resp. Cv ] be v’s neighbourhood in B [resp. C];
Step 3: Check all pairs in Bv × Cv for an edge;
Step 4: If |Bv |/|B| > |Cv |/|C|,
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Algorithm
log n
Given an n-node tripartite graph, fix ∆ = 100(log
.
log n)2
√
√
Step 0: If |B| < n or |C| < n, use exhaustive search;
Step 1: If for every v ∈ A, dv,B dv,C 6 |B||C|/∆2 , use the sparse
case algorithm;
Step 2: Otherwise, find a v ∈ A such that dv,B dv,C > |B||C|/∆2 ;
let Bv [resp. Cv ] be v’s neighbourhood in B [resp. C];
Step 3: Check all pairs in Bv × Cv for an edge;
Step 4: If |Bv |/|B| > |Cv |/|C|,
then recurse on (A, B, C \ Cv ) and (A, B \ Bv , Cv ),
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Algorithm
log n
Given an n-node tripartite graph, fix ∆ = 100(log
.
log n)2
√
√
Step 0: If |B| < n or |C| < n, use exhaustive search;
Step 1: If for every v ∈ A, dv,B dv,C 6 |B||C|/∆2 , use the sparse
case algorithm;
Step 2: Otherwise, find a v ∈ A such that dv,B dv,C > |B||C|/∆2 ;
let Bv [resp. Cv ] be v’s neighbourhood in B [resp. C];
Step 3: Check all pairs in Bv × Cv for an edge;
Step 4: If |Bv |/|B| > |Cv |/|C|,
then recurse on (A, B, C \ Cv ) and (A, B \ Bv , Cv ),
else recurse on (A, B \ Bv , C) and (A, Bv , C \ Cv ).
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Algorithm
Step 4: If |Bv |/|B| > |Cv |/|C|,
then recurse on (A, B, C \ Cv ) and (A, B \ Bv , Cv ),
else recurse on (A, B \ Bv , C) and (A, Bv , C \ Cv ).
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Algorithm
Step 4: If |Bv |/|B| > |Cv |/|C|,
then recurse on (A, B, C \ Cv ) and (A, B \ Bv , Cv ),
else recurse on (A, B \ Bv , C) and (A, Bv , C \ Cv ).
B
C
Cv
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Algorithm
Step 4: If |Bv |/|B| > |Cv |/|C|,
then recurse on (A, B, C \ Cv ) and (A, B \ Bv , Cv ),
else recurse on (A, B \ Bv , C) and (A, Bv , C \ Cv ).
B
B
C
Cv
Huacheng Yu
C
Bv
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Algorithm
log n
Given an n-node tripartite graph, fix ∆ = 100(log
.
log n)2
√
√
Step 0: If |B| < n or |C| < n, use exhaustive search;
Step 1: If for every v ∈ A, dv,B dv,C 6 |B||C|/∆2 , use the sparse
case algorithm;
Step 2: Otherwise, find a v ∈ A such that dv,B dv,C > |B||C|/∆2 ;
let Bv [resp. Cv ] be v’s neighbourhood in B [resp. C];
Step 3: Check all pairs in Bv × Cv for an edge;
Step 4: If |Bv |/|B| > |Cv |/|C|,
then recurse on (A, B, C \ Cv ) and (A, B \ Bv , Cv ),
else recurse on (A, B \ Bv , C) and (A, Bv , C \ Cv ).
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Algorithm
log n
Given an n-node tripartite graph, fix ∆ = 100(log
.
log n)2
√
√
Step 0: If |B| < n or |C| < n, use exhaustive search;
Step 1: If for every v ∈ A, dv,B dv,C 6 |B||C|/∆2 , use the sparse
case algorithm;
Step 2: Otherwise, find a v ∈ A such that dv,B dv,C > |B||C|/∆2 ;
let Bv [resp. Cv ] be v’s neighbourhood in B [resp. C];
Step 3: Check all pairs in Bv × Cv for an edge;
Step 4: If |Bv |/|B| > |Cv |/|C|,
then recurse on (A, B, C \ Cv ) and (A, B \ Bv , Cv ),
else recurse on (A, B \ Bv , C) and (A, Bv , C \ Cv ).
Correctness: straightforward.
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Analysis of the Running Time
Step 0: If |B| <
√
√
n or |C| < n, use exhaustive search;
Step 1: If for every v ∈ A, dv,B dv,C 6 |B||C|/∆2 , use the sparse
case algorithm;
Step 2: Otherwise, find a v ∈ A such that dv,B dv,C > |B||C|/∆2 ;
let Bv [resp. Cv ] be v’s neighbourhood in B [resp. C];
Step 3: Check all pairs in Bv × Cv for an edge;
Step 4: If |Bv |/|B| > |Cv |/|C|,
then recurse on (A, B, C \ Cv ) and (A, B \ Bv , Cv ),
else recurse on (A, B \ Bv , C) and (A, Bv , C \ Cv ).
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Analysis of the Running Time
Step 0: If |B| <
√
√
n or |C| < n, use exhaustive search; O(n|B||C|)
Step 1: If for every v ∈ A, dv,B dv,C 6 |B||C|/∆2 , use the sparse
case algorithm;
Step 2: Otherwise, find a v ∈ A such that dv,B dv,C > |B||C|/∆2 ;
let Bv [resp. Cv ] be v’s neighbourhood in B [resp. C];
Step 3: Check all pairs in Bv × Cv for an edge;
Step 4: If |Bv |/|B| > |Cv |/|C|,
then recurse on (A, B, C \ Cv ) and (A, B \ Bv , Cv ),
else recurse on (A, B \ Bv , C) and (A, Bv , C \ Cv ).
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Analysis of the Running Time
Step 0: If |B| <
√
√
n or |C| < n, use exhaustive search; O(n|B||C|)
Step 1: If for every v ∈ A, dv,B dv,C 6 |B||C|/∆2 , use the sparse
Ô(n|B||C|/ log4 n)
case algorithm;
Step 2: Otherwise, find a v ∈ A such that dv,B dv,C > |B||C|/∆2 ;
let Bv [resp. Cv ] be v’s neighbourhood in B [resp. C];
Step 3: Check all pairs in Bv × Cv for an edge;
Step 4: If |Bv |/|B| > |Cv |/|C|,
then recurse on (A, B, C \ Cv ) and (A, B \ Bv , Cv ),
else recurse on (A, B \ Bv , C) and (A, Bv , C \ Cv ).
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Analysis of the Running Time
Step 0: If |B| <
√
√
n or |C| < n, use exhaustive search; O(n|B||C|)
Step 1: If for every v ∈ A, dv,B dv,C 6 |B||C|/∆2 , use the sparse
Ô(n|B||C|/ log4 n)
case algorithm;
Step 2: Otherwise, find a v ∈ A such that dv,B dv,C > |B||C|/∆2 ;
let Bv [resp. Cv ] be v’s neighbourhood in B [resp. C];
O(n(|B| + |C|))
Step 3: Check all pairs in Bv × Cv for an edge;
O(|Bv ||Cv |)
Step 4: If |Bv |/|B| > |Cv |/|C|,
then recurse on (A, B, C \ Cv ) and (A, B \ Bv , Cv ),
else recurse on (A, B \ Bv , C) and (A, Bv , C \ Cv ).
O(n(|B| + |C|))
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Analysis of the Running Time
- Small graph case:
√
√
Step 0: If |B| < n or |C| < n, use exhaustive search; O(n|B||C|)
Step 1: If for every v ∈ A, dv,B dv,C 6 |B||C|/∆2 , use the sparse
Ô(n|B||C|/ log4 n)
case algorithm;
Step 2: Otherwise, find a v ∈ A such that dv,B dv,C > |B||C|/∆2 ;
let Bv [resp. Cv ] be v’s neighbourhood in B [resp. C];
O(n(|B| + |C|))
Step 3: Check all pairs in Bv × Cv for an edge;
O(|Bv ||Cv |)
Step 4: If |Bv |/|B| > |Cv |/|C|,
then recurse on (A, B, C \ Cv ) and (A, B \ Bv , Cv ),
else recurse on (A, B \ Bv , C) and (A, Bv , C \ Cv ).
O(n(|B| + |C|))
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Analysis of the Running Time
- Small graph case:
√
√
Step 0: If |B| < n or |C| < n, use exhaustive search; O(n|B||C|)
- Large graph case:
Step 1: If for every v ∈ A, dv,B dv,C 6 |B||C|/∆2 , use the sparse
Ô(n|B||C|/ log4 n)
case algorithm;
Step 2: Otherwise, find a v ∈ A such that dv,B dv,C > |B||C|/∆2 ;
let Bv [resp. Cv ] be v’s neighbourhood in B [resp. C];
O(n(|B| + |C|))
Step 3: Check all pairs in Bv × Cv for an edge;
O(|Bv ||Cv |)
Step 4: If |Bv |/|B| > |Cv |/|C|,
then recurse on (A, B, C \ Cv ) and (A, B \ Bv , Cv ),
else recurse on (A, B \ Bv , C) and (A, Bv , C \ Cv ).
O(n(|B| + |C|))
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Analysis of the Running Time
- Small graph case:
√
√
Step 0: If |B| < n or |C| < n, use exhaustive search; O(n|B||C|)
- Large graph case:
Step 1: If for every v ∈ A, dv,B dv,C 6 |B||C|/∆2 , use the sparse
Ô(n|B||C|/ log4 n)
case algorithm;
Step 2: Otherwise, find a v ∈ A such that dv,B dv,C > |B||C|/∆2 ;
let Bv [resp. Cv ] be v’s neighbourhood in B [resp. C];
O(n(|B| + |C|))
Step 3: Check all pairs in Bv × Cv for an edge;
O(|Bv ||Cv |)
Step 4: If |Bv |/|B| > |Cv |/|C|,
then recurse on (A, B, C \ Cv ) and (A, B \ Bv , Cv ),
else recurse on (A, B \ Bv , C) and (A, Bv , C \ Cv ).
O(n(|B| + |C|))
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Large Graph Case
Large graph case (|B|, |C| >
√
n):
Step 1: If for every v ∈ A, dv,B dv,C 6 |B||C|/∆2 , use the sparse
case algorithm;
Ô(n|B||C|/ log4 n)
Step 2: Otherwise, find a v ∈ A such that dv,B dv,C > |B||C|/∆2 ;
let Bv [resp. Cv ] be v’s neighbourhood in B [resp. C];
O(n(|B| + |C|))
Step 3: Check all pairs in Bv × Cv for an edge;
O(|Bv ||Cv |)
Step 4: If |Bv |/|B| > |Cv |/|C|,
then recurse on (A, B, C \ Cv ) and (A, B \ Bv , Cv ),
else recurse on (A, B \ Bv , C) and (A, Bv , C \ Cv ).
O(n(|B| + |C|))
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Large Graph Case
√
Large graph case (|B|, |C| > n):
sparse case algorithm.
Ô(n|B||C|/ log4 n)
Step 2: Otherwise, find a v ∈ A such that dv,B dv,C > |B||C|/∆2 ;
let Bv [resp. Cv ] be v’s neighbourhood in B [resp. C];
O(n(|B| + |C|))
Step 3: Check all pairs in Bv × Cv for an edge;
O(|Bv ||Cv |)
Step 4: If |Bv |/|B| > |Cv |/|C|,
then recurse on (A, B, C \ Cv ) and (A, B \ Bv , Cv ),
else recurse on (A, B \ Bv , C) and (A, Bv , C \ Cv ).
O(n(|B| + |C|))
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Large Graph Case
Large graph case (|B|, |C| >
√
n):
Ô(n|B||C|/ log4 n)
sparse case algorithm.
check degrees, generate inputs for recursion.
Step 3: Check all pairs in Bv × Cv for an edge;
Huacheng Yu
O(n(|B| + |C|))
O(|Bv ||Cv |)
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Large Graph Case
Large graph case (|B|, |C| >
sparse case algorithm.
√
n):
Ô(n|B||C|/ log4 n)
check degrees, generate inputs for recursion.
check Bv × Cv .
Huacheng Yu
O(n(|B| + |C|))
O(|Bv ||Cv |)
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Large Graph Case
Large graph case (|B|, |C| >
√
n):
Ô(n|B||C|/ log4 n)
sparse case algorithm.
check degrees, generate inputs for recursion.
O(n(|B| + |C|))
O(|Bv ||Cv |)
check Bv × Cv .
Charge the running time to pairs in B × C:
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Large Graph Case
Large graph case (|B|, |C| >
√
n):
Ô(n|B||C|/ log4 n)
sparse case algorithm.
check degrees, generate inputs for recursion.
O(n(|B| + |C|))
O(|Bv ||Cv |)
check Bv × Cv .
Charge the running time to pairs in B × C:
sparse case: charge to B × C evenly.
Huacheng Yu
Ô(n/ log4 n) per pair
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Large Graph Case
Large graph case (|B|, |C| >
√
n):
Ô(n|B||C|/ log4 n)
sparse case algorithm.
check degrees, generate inputs for recursion.
O(n(|B| + |C|))
O(|Bv ||Cv |)
check Bv × Cv .
Charge the running time to pairs in B × C:
sparse case: charge to B × C evenly.
Huacheng Yu
Ô(n/ log4 n) per pair
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Large Graph Case
Large graph case (|B|, |C| >
√
n):
Ô(n|B||C|/ log4 n)
sparse case algorithm.
check degrees, generate inputs for recursion.
O(n(|B| + |C|))
O(|Bv ||Cv |)
check Bv × Cv .
Charge the running time to pairs in B × C:
Ô(n/ log4 n) per pair
√
dense case: charge to Bv × Cv evenly. O( n log2 n) per pair
sparse case: charge to B × C evenly.
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Large Graph Case
Large graph case (|B|, |C| >
√
n):
Ô(n|B||C|/ log4 n)
sparse case algorithm.
check degrees, generate inputs for recursion.
O(n(|B| + |C|))
O(|Bv ||Cv |)
check Bv × Cv .
Charge the running time to pairs in B × C:
Ô(n/ log4 n) per pair
√
dense case: charge to Bv × Cv evenly. O( n log2 n) per pair
sparse case: charge to B × C evenly.
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Large Graph Case
Large graph case (|B|, |C| >
√
n):
Ô(n|B||C|/ log4 n)
sparse case algorithm.
check degrees, generate inputs for recursion.
O(n(|B| + |C|))
O(|Bv ||Cv |)
check Bv × Cv .
Charge the running time to pairs in B × C:
Ô(n/ log4 n) per pair
√
dense case: charge to Bv × Cv evenly. O( n log2 n) per pair
sparse case: charge to B × C evenly.
Every pair is charged at most once!
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Large Graph Case
Large graph case (|B|, |C| >
√
n):
Ô(n|B||C|/ log4 n)
sparse case algorithm.
check degrees, generate inputs for recursion.
O(n(|B| + |C|))
O(|Bv ||Cv |)
check Bv × Cv .
Charge the running time to pairs in B × C:
Ô(n/ log4 n) per pair
√
dense case: charge to Bv × Cv evenly. O( n log2 n) per pair
sparse case: charge to B × C evenly.
Every pair is charged at most once!
only charge to pairs not going into the same recursive branch.
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Large Graph Case
Large graph case (|B|, |C| >
√
n):
Ô(n|B||C|/ log4 n)
sparse case algorithm.
check degrees, generate inputs for recursion.
O(n(|B| + |C|))
O(|Bv ||Cv |)
check Bv × Cv .
Charge the running time to pairs in B × C:
Ô(n/ log4 n) per pair
√
dense case: charge to Bv × Cv evenly. O( n log2 n) per pair
sparse case: charge to B × C evenly.
Every pair is charged at most once!
only charge to pairs not going into the same recursive branch.
Time spent on large graph case: Ô(n3 / log4 n).
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Analysis of the Running Time
- Small graph case:
√
√
Step 0: If |B| < n or |C| < n, use exhaustive search; O(n|B||C|)
- Large graph case:
Step 1: If for every v ∈ A, dv,B dv,C 6 |B||C|/∆2 , use the sparse
case algorithm;
Ô(n|B||C|/ log4 n)
Step 2: Otherwise, find a v ∈ A such that dv,B dv,C > |B||C|/∆2 ;
let Bv [resp. Cv ] be v’s neighbourhood in B [resp. C];
O(n(|B| + |C|))
Step 3: Check all pairs in Bv × Cv for an edge;
O(|Bv ||Cv |)
Step 4: If |Bv |/|B| > |Cv |/|C|,
then recurse on (A, B, C \ Cv ) and (A, B \ Bv , Cv ),
else recurse on (A, B \ Bv , C) and (A, Bv , C \ Cv ).
O(n(|B| + |C|))
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Small Graph Case
Step 0: If |B| <
√
√
n or |C| < n, use exhaustive search; O(n|B||C|)
Let v: dv,B dv,C > |B||C|/∆2 . (∆ = Θ(log n/(log log n)2 ))
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Small Graph Case
Step 0: If |B| <
√
√
n or |C| < n, use exhaustive search; O(n|B||C|)
Let v: dv,B dv,C > |B||C|/∆2 . (∆ = Θ(log n/(log log n)2 ))
For simplicity, assume dv,B = |B|/∆, dv,C = |C|/∆.
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Small Graph Case
Step 0: If |B| <
√
√
n or |C| < n, use exhaustive search; O(n|B||C|)
Let v: dv,B dv,C > |B||C|/∆2 . (∆ = Θ(log n/(log log n)2 ))
For simplicity, assume dv,B = |B|/∆, dv,C = |C|/∆.
Huacheng Yu
B
C
B
C
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Small Graph Case
Step 0: If |B| <
√
√
n or |C| < n, use exhaustive search; O(n|B||C|)
Let v: dv,B dv,C > |B||C|/∆2 . (∆ = Θ(log n/(log log n)2 ))
For simplicity, assume dv,B = |B|/∆, dv,C = |C|/∆.
···
B
C
B
C
···
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Small Graph Case
Step 0: If |B| <
√
√
n or |C| < n, use exhaustive search; O(n|B||C|)
Let v: dv,B dv,C > |B||C|/∆2 . (∆ = Θ(log n/(log log n)2 ))
For simplicity, assume dv,B = |B|/∆, dv,C = |C|/∆.
B
C
B
C
n2
···
···
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Small Graph Case
Step 0: If |B| <
√
√
n or |C| < n, use exhaustive search; O(n|B||C|)
Let v: dv,B dv,C > |B||C|/∆2 . (∆ = Θ(log n/(log log n)2 ))
For simplicity, assume dv,B = |B|/∆, dv,C = |C|/∆.
B
C
B
C
n2
(1 − ∆−1 )n2
···
∆−1 (1 − ∆−1 )n2
···
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Small Graph Case
Step 0: If |B| <
√
√
n or |C| < n, use exhaustive search; O(n|B||C|)
Let v: dv,B dv,C > |B||C|/∆2 . (∆ = Θ(log n/(log log n)2 ))
For simplicity, assume dv,B = |B|/∆, dv,C = |C|/∆.
B
C
B
C
n2
(1 − ∆−1 )n2
∆−1 (1 − ∆−1 )n2
∆−1 (1 − ∆−1 )2 n2
∆−1 (1 − ∆−1 )3 n2
···
···
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Small Graph Case
Step 0: If |B| <
√
√
n or |C| < n, use exhaustive search; O(n|B||C|)
Let v: dv,B dv,C > |B||C|/∆2 . (∆ = Θ(log n/(log log n)2 ))
For simplicity, assume dv,B = |B|/∆, dv,C = |C|/∆.
B
C
B
C
n2
(1 − ∆−1 )n2
∆−1 (1 − ∆−1 )n2
∆−1 (1 − ∆−1 )2 n2
∆−1 (1 − ∆−1 )3 n2
···
···
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Small Graph Case
Step 0: If |B| <
√
√
n or |C| < n, use exhaustive search; O(n|B||C|)
Let v: dv,B dv,C > |B||C|/∆2 . (∆ = Θ(log n/(log log n)2 ))
For simplicity, assume dv,B = |B|/∆, dv,C = |C|/∆.
−1
(1 − ∆
B
C
B
C
2
)n
n2
(1 − ∆−1 )n2
∆−1 (1 − ∆−1 )n2
∆−1 (1 − ∆−1 )2 n2
∆−1 (1 − ∆−1 )3 n2
···
···
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Small Graph Case
Step 0: If |B| <
√
√
n or |C| < n, use exhaustive search; O(n|B||C|)
Let v: dv,B dv,C > |B||C|/∆2 . (∆ = Θ(log n/(log log n)2 ))
For simplicity, assume dv,B = |B|/∆, dv,C = |C|/∆.
(1 − ∆−1 )n2
n2
(1 − ∆−1 )n2
Ω(∆ log log n) right steps:
O(n3 / log10 n)
∆−1 (1 − ∆−1 )n2
∆−1 (1 − ∆−1 )2 n2
∆−1 (1 − ∆−1 )3 n2
···
···
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Small Graph Case
Step 0: If |B| <
√
√
n or |C| < n, use exhaustive search; O(n|B||C|)
Let v: dv,B dv,C > |B||C|/∆2 . (∆ = Θ(log n/(log log n)2 ))
For simplicity, assume dv,B = |B|/∆, dv,C = |C|/∆.
(1 − ∆−1 )n2
n2
(1 − ∆−1 )n2
Ω(∆ log log n) right steps:
O(n3 / log10 n)
∆−1 (1 − ∆−1 )n2
# nodes with O(∆ log log n)
right steps: n0.4
∆−1 (1 − ∆−1 )2 n2
∆−1 (1 − ∆−1 )3 n2
···
···
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Small Graph Case
Step 0: If |B| <
√
√
n or |C| < n, use exhaustive search; O(n|B||C|)
6 O(n2.5 )
Let v: dv,B dv,C > |B||C|/∆2 . (∆ = Θ(log n/(log log n)2 ))
For simplicity, assume dv,B = |B|/∆, dv,C = |C|/∆.
(1 − ∆−1 )n2
n2
(1 − ∆−1 )n2
Ω(∆ log log n) right steps:
O(n3 / log10 n)
∆−1 (1 − ∆−1 )n2
# nodes with O(∆ log log n)
right steps: n0.4
∆−1 (1 − ∆−1 )2 n2
∆−1 (1 − ∆−1 )3 n2
···
···
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Small Graph Case
Step 0: If |B| <
√
√
n or |C| < n, use exhaustive search; O(n|B||C|)
6 O(n2.5 )
Let v: dv,B dv,C > |B||C|/∆2 . (∆ = Θ(log n/(log log n)2 ))
For simplicity, assume dv,B = |B|/∆, dv,C = |C|/∆.
(1 − ∆−1 )n2
n2
(1 − ∆−1 )n2
Ω(∆ log log n) right steps:
O(n3 / log10 n)
∆−1 (1 − ∆−1 )n2
# nodes with O(∆ log log n)
right steps: n0.4
∆−1 (1 − ∆−1 )2 n2
∆−1 (1 − ∆−1 )3 n2
···
O(n3 / log10 n) time.
···
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Algorithm
log n
Given an n-node tripartite graph, fix ∆ = 100(log
.
log n)2
√
√
Step 0: If |B| < n or |C| < n, use exhaustive search;
Step 1: If for every v ∈ A, dv,B dv,C 6 |B||C|/∆2 , use the sparse
case algorithm;
Step 2: Otherwise, find a v ∈ A such that dv,B dv,C > |B||C|/∆2 ;
Let Bv [resp. Cv ] be v’s neighbourhood in B [resp. C];
Step 3: Check all pairs in Bv × Cv for an edge;
Step 4: If |Bv |/|B| > |Cv |/|C|,
then recurse on (A, B, C \ Cv ) and (A, B \ Bv , Cv ),
else recurse on (A, B \ Bv , C) and (A, Bv , C \ Cv ).
Correctness: straightforward.
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
The Algorithm
log n
Given an n-node tripartite graph, fix ∆ = 100(log
.
log n)2
√
√
Step 0: If |B| < n or |C| < n, use exhaustive search;
Step 1: If for every v ∈ A, dv,B dv,C 6 |B||C|/∆2 , use the sparse
case algorithm;
Step 2: Otherwise, find a v ∈ A such that dv,B dv,C > |B||C|/∆2 ;
Let Bv [resp. Cv ] be v’s neighbourhood in B [resp. C];
Step 3: Check all pairs in Bv × Cv for an edge;
Step 4: If |Bv |/|B| > |Cv |/|C|,
then recurse on (A, B, C \ Cv ) and (A, B \ Bv , Cv ),
else recurse on (A, B \ Bv , C) and (A, Bv , C \ Cv ).
Correctness: straightforward.
Huacheng Yu
Running time: Ô(n3 / log4 n).
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Conclusion
Ô(n3 / log4 n) time algorithm for triangle detection and
Boolean MM
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Conclusion
Ô(n3 / log4 n) time algorithm for triangle detection and
Boolean MM
A general framework for triangle detection
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Conclusion
Ô(n3 / log4 n) time algorithm for triangle detection and
Boolean MM
A general framework for triangle detection
Open problem:
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Conclusion
Ô(n3 / log4 n) time algorithm for triangle detection and
Boolean MM
A general framework for triangle detection
Open problem:
Triangle detection on tripartite graphs with vertex set sizes
n, n, Ô(log4 n) in O(n2 ) time?
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Conclusion
Ô(n3 / log4 n) time algorithm for triangle detection and
Boolean MM
A general framework for triangle detection
Open problem:
Triangle detection on tripartite graphs with vertex set sizes
n, n, Ô(log4 n) in O(n2 ) time?
Multiplying n × n and n × Ô(log4 n) Boolean matrices in
O(n2 )
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Conclusion
Ô(n3 / log4 n) time algorithm for triangle detection and
Boolean MM
A general framework for triangle detection
Open problem:
Triangle detection on tripartite graphs with vertex set sizes
n, n, Ô(log4 n) in O(n2 ) time?
Multiplying n × n and n × Ô(log4 n) Boolean matrices in
O(n2 )
Current record: Ô(log3 n) by Chan.
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication
Introduction
Triangle Detection Algorithm
Conclusion
Conclusion
Ô(n3 / log4 n) time algorithm for triangle detection and
Boolean MM
A general framework for triangle detection
Open problem:
Triangle detection on tripartite graphs with vertex set sizes
n, n, Ô(log4 n) in O(n2 ) time?
Multiplying n × n and n × Ô(log4 n) Boolean matrices in
O(n2 )
Current record: Ô(log3 n) by Chan.
Thanks!
Huacheng Yu
An Improved Combinatorial Algorithm for Boolean Matrix Multiplication