Bild 1

advertisement
Andreas Björklund
Undirected Hamiltonicity
 Instance: Undirected graph G=(V,E) on n vertices.
 Question: Is there a vertex permutation
v1,v2,…,vn such that vivi+1 in E for all i, including vnv1?
Examples
Yes
No
History
 Introduced by Kirkman 1855.
 Popularized by Hamilton 1857.
 Special case of traveling salesman problem studied
since 1930.
 Exact algorithm for TSP in O*(2n) time in 1962 by
Bellman, Held and Karp, and Gonzalez.
 Proved NP-complete in Karp’s 1972 paper.
 Polynomial space O*(2n) time algorithm by Kohn,
Gottlieb, and Kohn 1977, Karp 1982, and Bax 1993.
Gerhard Woeginger’s 2003 Survey
 Open problem:
Construct an exact algorithm for the travelling
salesman problem with complexity O*(cn) for some
c<2. In fact, it even would be interesting to reach such a
time complexity O*(cn) for some c<2 for the closely
related, but slightly simpler Hamiltonian cycle
problem.
Our Results
 There is a Monte Carlo algorithm that detects if any
input n-vertex undirected graph is Hamiltonian or not
running in O*(1.657n) time.
 In bipartite graphs, O*(1.414n) time.
 Small weight TSP in O*(1.657nw) time, where w is the
sum of all weights.
Old Idea 1: Dynamic Programming
Across the Vertex Subsets
(Bellman, Held and Karp, and Gonzalez.)
 Grow the path one vertex at a time, remembering
which vertices were previously visited (but not the
order in which they were traversed).
dpxx   1: x  t,0 : otherwise
dpX  ss 
 dpX u
su E
uX
Old Idea 2: Inclusion-Exclusion
Counting Across the Vertex Subsets
(Kohn, Gottlieb, and Kohn, Karp, and Bax.)
 For every vertex subset, count the number of closed
walks on n vertices in the induced graph. Sum up the
results with alternating signs determined by the parity
of the vertex subset.
(1)
X  n 
n X
(AX )
n
s,s
Too Good?
Our
algorithm here… algorithm…
The inclusion-exclusion
 Uses exponential
space,
(but we can get rid of it)
only polynomial
space,
 Works only
in undirected
graphs,
also for
directed graphs,
 Is randomized,
deterministic,
 And cannot
evensolutions.
approximately count the solutions.
counts the
Common Obstacle
 Both algorithms keep track of the vertices visited by
explicitly enumerating all vertex subsets.
 We have to figure out how to bookkeep visited vertices
in a cheaper way.
 First idea: Restrict the input space.
Previous Restricted Input Results
 O*(1.251n) time for cubic graphs (Eppstein’07, Iwama
and Nakashima’07)
 O*(1.715n) time for graphs of degree at most four
(Gebaur’08)
 O*((2-e(d))n) time for graphs of bounded degree d
(B.,Husfeldt, Kaski, and Koivisto ’08)
 O*(1.682n) time for claw-free graphs (Broersma, Fomin
van’t Hof, and Paulusma ’09)
Bipartite Graphs
A Hamiltonian cycle (when it exists) visits vertices
from the two color classes in the bipartition
alternatively.
Labeled Hamiltonicity?
1
A
1
2
B
B
C
AB
3
AF
D
4
3
BC
2
AE CE
5
E
E
6
BF
BD
CD
BE
4
5
DE
EF
F
6
n=12 vertices
n’=n/2=6 vertices
|L|=n/2=6 edge labels
Labeled Hamiltonicity
 We have to keep track of visited vertices and used
labels. Seems like O*(2n’2|L|)=O*(2n). Have we really
gained anything?
Yes,
We will describe an O*(2|L|) time randomized algorithm
based on counting in characterstic two.
The Tutte Matrix
1
x16

T
1
2
3
4
5
6
x15
1
0
x12
x13
0
x15
x16
3
2
x12
0
x23
x24
x25
x26
3
x13
x23
0
x34
x35
0
4
0
x24
x34
0
x45
x46
5
x15
x25
x35
x45
0
x56
6
x16
x26
0
x46
x56
0
2
5
4
x 56
6

det(T)  x122 x 342 x 562  x122 x2352 x 462  x132 x 242 x 562  x132 x 2622x452
det(T) 2 2 x162 x 262x 232 x132 x 452 +2 x2 16 x 262 x223 x2 13 x 452 +2 2…
x15 x 23 x 46  x15 x24 x 36  x16 x23 x 45  x16 x 24 x 35  x16 x 25 x 34
0
Special Asymmetric Vertex
1
3
x16 '
x16
2
5
4
T
1
2
3
4
5
6
1
0
x12
x13
0
x15
x16
2
x12’
0
x23
x24
x25
x26
3
x13’
x23
0
x34
x35
0
4
0
x24
x34
0
x45
x46
5
x15’
x25
x35
x45
0
x56
6
x16’
x26
0
x46
x56
0
6
det(T)  x16 x 26 x23 x13 ' x452
2
+ x16 ' x 26 x 23 x13 x 45
+ …
0
Labeled Cycle Covers
1
Labels
L={A,B,C,D,E,F}
x16,F x 26,A x 23,C x13,B ' x 45,D x 45,E
B
F
F
B
C
C
+
2
A
A
6

3
4
D E
ED
5
x16,F x 26,A x 23,C x13,B ' x 45,E x 45,D

x 56,A , x 56,B ,...,x 56,F
0
We can use inclusion-exclusion
counting to compute the labeled
cycle covers.

Labeled Tutte Matrices
1
B
AB
AF
BC
2
AE CE
E
6
TC
1
2
3
4
5
6
BF
1
0
0
0
0
0
0
3
2
0
0
x23,c x24,c 0
0
3
0
x23,c 0
4
0
x24,c x34,c 0
0
0
5
0
0
0
0
0
0
6
0
0
0
0
0
0
BD
CD
BE
5
4 DE
EF
x34,c 0
0
det(T )  x12,B x23,C x34,D x45,E x56,F x16,A '...
S
X L
SX
Algorithm
Input: Bipartite graph G=(U,V,E) on n vertices.
1) Reduce to labeled Hamiltonicity instance G’=(V,E’) and
labels L=U.
2) Fix field F of characteristic two of size >>n’.
3) Assign values from F to xij,l for all ij in E’ and labels l in L,
uniformly and independently at random.
4) Compute H 
det( TS )
S X
5) If H nonzero X L
return Yes,
else
return No.



Analysis
 Runtime O*(2|L|) = O*(2n/2) since computing a
numerical determinant is a polynomial time task.
 No false positives: if H is nonzero there must be a
Hamiltonian cycle.
 False negatives with exponentially small probability of
failure (in n): H is an n-degree multivariate
polynomial and is zero in at most n/|F| points by the
Schwartz-Zippel Lemma.
General Graphs vs Bipartite Ones
 We don’t have a natural a priori way of partitioning a




graph’s vertices in labels and vertices of a labeled
Hamiltonicity instance.
First idea: we can use subsets (not just singletons) of a
label set to label the edges in a labeled cycle cover.
We will use a random equipartitioning of the vertices.
Problem: We cannot label edges with the empty set.
Second idea: we add a few labels on every direct edge.
Subset Labeled Hamiltonicity
1
A
B
L’={a,b}
{a}{b}{ADE}{AB}
2
1
{a}{b}{AD}
3
2
3
5
C
4
D
{C}{BADE}
{B}{C}
{a}{b}{DE}
4
5
E
{C}{E}{BADE}
n=10 vertices
n’=n/2=5 vertices
|L|=n/2+|L’|=7 edge labels
How Many Direct Edge Labels are
Needed?
 Consider a fixed Hamiltonian cycle H.
 If we choose an equipartition of the input graphs
vertices and use half of them as vertices in a subset
labeled Hamiltonicity instance, we get n/4 direct edges
in expectation along H.
 We need in total n/2+n/4=3n/4 labels.
 Can we still find a O*(2|L|) time algorithm for Subset
Label Hamiltonicity?
Going Exponential
 Instead of one matrix per label, we imagine one matrix
TX per label subset X.
TX ,ij

x ij,l


  x ij,l
lX

 0
:
l  X edge label, ij  E
: X  L  L',
:
path i  X  j
otherwise.


 Now detTY gives us what we want.
Y X 
X L
Computing


detTY 
Y X 
X L
 We can use a recursion like the Bellman-Held-Karp-
Gonzalez dynammic programming to compute all
matrices
TX in O*(2n-n’) time.
 We can use the fast zeta transform to compute and
tabulate the inner sum
T
Y
Y X
for all X’s in O*(2|L|) time.
Analysis and Extensions
 We still have O*(2|L|) time algorithm, and
remembering |L|=3n/4 we get O*(1.682n) time.
 We can trade a few labels for a modest exponential
number of runs to get an O*(1.657n) time algorithm.
 We can use walks instead of paths in the labels’
construction getting a polynomial space algorithm
with the same running time.
 By adjoining a new indeterminate we can embed a
min-sum semiring in the polynomial and solve for TSP.
Another Related Technique
(Joint work with Husfeldt, Kaski, and Koivisto)
 Idea: Count labeled walks instead of labeled cycle
covers.
 We don’t need determinants.
 Previous reductions from Hamiltonicity to Subset
Labeled Hamiltonicity still in play.
Labeled Walks
2
B
FF
1
E
B C
A
3
D
D
A
C
B,D,E
5
4
E
6
x13,F x 34,A x 42,C x 23,B x 36,D x 61,E ' + x13,F x 32,B x 24,C x 43,A x 36,E x 61,D '
0
Why Label at All?
2
5
1
4
3
6
Counted only once!
Aha! Just don’t Backtrack
2
5
1
4
3
6
1->6->3->4->6->3->1
1->6->4->3->6->3->1
What about k-Path?
 Given undirected graph G=(V,E) and positive integer k,
determine if there is a simple path of length k in G.
 Just count labeled walks of length k’ instead of closed
labeled walks of length n’.
 Then we only need a k’/n’ fraction of the labels!
 Poly(n,k)1.657k time algorithm.
Open Questions
 Could 1.657 really be the optimal base?
 Can we find other k-vertex subgraphs faster with
labeling techniques?
 Can we derandomize the bipartite Hamiltonicity
algorithm?
 Is characteristic two essential?
Thank you for listening!
Download