# Determinant Sums (and Labeled Walks) for Undirected Hamiltonicity

## Presentation on theme: "Determinant Sums (and Labeled Walks) for Undirected Hamiltonicity"— Presentation transcript:

Determinant Sums (and Labeled Walks) for Undirected Hamiltonicity
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).

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.

Too Good? Our algorithm here…
Uses exponential space, (but we can get rid of it) Works only in undirected graphs, Is randomized, And cannot even approximately count the solutions. The inclusion-exclusion algorithm… Uses only polynomial space, Works also for directed graphs, Is deterministic, And counts the solutions.

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 2 1 BF B B 3 A B C 3 BD B C C D A F 2 BE D 5 AE CE 4 D E 5 4 E E E F 6 F 6 n’=n/2=6 vertices n=12 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 T 1 2 3 4 5 6 x12 x13 x15 x16 x23 x24 x25 x26
x12 x13 x15 x16 x23 x24 x25 x26 x34 x35 x45 x46 x56 3 2 5 4 6 + + …

Special Asymmetric Vertex
1 T 1 2 3 4 5 6 x12 x13 x15 x16 x12’ x23 x24 x25 x26 x13’ x34 x35 x45 x46 x15’ x56 x16’ 3 2 5 4 6 + + …

Labeled Cycle Covers Labels L={A,B,C,D,E,F}
1 Labels L={A,B,C,D,E,F} B B 3 C + C F 2 E F D 5 A D E 4 A We can use inclusion-exclusion counting to compute the labeled cycle covers. 6

Labeled Tutte Matrices
1 TC 1 2 3 4 5 6 x23,c x24,c x34,c BF B 3 A B BD B C C D A F 2 BE 5 CE AE D E 4 E E F 6

Algorithm Input: Bipartite graph G=(U,V,E) on n vertices.
Reduce to labeled Hamiltonicity instance G’=(V,E’) and labels L=U. Fix field F of characteristic two of size >>n’. Assign values from F to xij,l for all ij in E’ and labels l in L, uniformly and independently at random. Compute If H nonzero 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} {AD} {a} {b} {ADE} {AB} 1 2 3 2 3 C {C} {BADE} 5 {B} {C} D 4 {a} {b} {DE} 4 5 {C} {E} {BADE} E 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. Now gives us what we want.

Computing 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 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 C B C F F A B,D,E 1 5 3 4 A E D D E 6 +

Why Label at All? 2 1 5 3 4 6 Counted only once!

Aha! Just don’t Backtrack
2 1 5 3 4 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!