350 likes | 502 Views
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
E N D
Determinant Sums(and Labeled Walks) for UndirectedHamiltonicity Andreas Björklund
UndirectedHamiltonicity • Instance: Undirectedgraph G=(V,E) on n vertices. • Question: Is there a vertex permutation v1,v2,…,vnsuch that vivi+1 in E for all i, including vnv1?
Examples No Yes
History • Introduced by Kirkman 1855. • Popularized by Hamilton 1857. • Special case of travelingsalesman problem studiedsince 1930. • Exactalgorithm for TSP in O*(2n) time in 1962 by Bellman, Held and Karp, and Gonzalez. • ProvedNP-complete in Karp’s 1972 paper. • Polynomialspace O*(2n) time algorithm by Kohn, Gottlieb, and Kohn 1977, Karp 1982, and Bax 1993.
Gerhard Woeginger’s 2003 Survey • Open problem: Construct an exactalgorithm for the travellingsalesman problem with complexityO*(cn) for some c<2. In fact, it evenwould be interesting to reachsuch a time complexityO*(cn) for some c<2 for the closelyrelated, butslightlysimplerHamiltoniancycle problem.
Our Results • There is a Monte Carlo algorithm that detectsifany input n-vertexundirectedgraph is Hamiltonian or not running in O*(1.657n) time. • In bipartitegraphs, O*(1.414n) time. • Small weight TSP in O*(1.657nw) time, where w is the sum of all weights.
Old Idea 1: DynamicProgrammingAcross the Vertex Subsets (Bellman, Held and Karp, and Gonzalez.) • Grow the pathonevertex at a time, rememberingwhichverticeswerepreviouslyvisited (but not the order in whichtheyweretraversed).
Old Idea 2: Inclusion-ExclusionCountingAcross the Vertex Subsets (Kohn, Gottlieb, and Kohn, Karp, and Bax.) • For everyvertex subset, count the number of closedwalks on n vertices in the inducedgraph. Sum up the results with alternatingsignsdetermined by the parity of the vertex subset.
Too Good? Ouralgorithmhere… • Usesexponential space, (butwecan get rid of it) • Works only in undirectedgraphs, • Is randomized, • And cannotevenapproximatelycount the solutions. The inclusion-exclusionalgorithm… • Usesonlypolynomialspace, • Works also for directedgraphs, • Is deterministic, • And counts the solutions.
CommonObstacle • Bothalgorithmskeeptrack of the verticesvisited by explicitlyenumerating all vertex subsets. • Wehave to figureouthow to bookkeepvisitedvertices in a cheaperway. • First idea: Restrict the input space.
PreviousRestricted Input Results • O*(1.251n) time for cubicgraphs (Eppstein’07, Iwama and Nakashima’07) • O*(1.715n) time for graphs of degree at mostfour (Gebaur’08) • O*((2-e(d))n) time for graphs of boundeddegree d (B.,Husfeldt, Kaski, and Koivisto ’08) • O*(1.682n) time for claw-freegraphs (Broersma, Fomin van’tHof, and Paulusma ’09)
Bipartite Graphs A Hamiltoniancycle (when it exists) visits vertices from the twocolorclasses in the bipartitionalternatively.
Labeled Hamiltonicity? 1 A 1 2 BF B B 3 B A BD C 3 C B D C A F 2 BE D 5 CE AE 4 D E 5 4 E E F E 6 F 6 n’=n/2=6 vertices n=12 vertices |L|=n/2=6 edgelabels
Labeled Hamiltonicity • Wehave to keeptrack of visitedverticesandusedlabels. Seems like O*(2n’2|L|)=O*(2n). Havewereallygainedanything? Yes, Wewilldescribe an O*(2|L|) time randomizedalgorithmbased on counting in characterstictwo.
The Tutte Matrix 1 3 2 5 4 6 + + …
Special AsymmetricVertex 1 3 2 5 4 6 + + …
Labeled Cycle Covers 1 Labels L={A,B,C,D,E,F} B B 3 C + C F 2 E D F 5 D A E 4 A Wecanuseinclusion-exclusioncounting to compute the labeledcycle covers. 6
Labeled Tutte Matrices 1 BF B 3 BD A B C B C D A F 2 BE 5 CE AE D E 4 E F E 6
Algorithm Input: Bipartitegraph G=(U,V,E) on n vertices. • Reduce to labeledHamiltonicityinstance G’=(V,E’) and labels L=U. • Fix field F of characteristictwo of size >>n’. • Assignvalues from F to xij,l for all ij in E’ and labelsl in L, uniformly and independently at random. • Compute • IfHnonzero returnYes, else return No.
Analysis • Runtime O*(2|L|) = O*(2n/2) sincecomputing a numerical determinant is a polynomial time task. • No false positives: if H is nonzerothere must be a Hamiltoniancycle. • False negatives with exponentially small probability of failure (in n): H is an n-degreemultivariatepolynomial and is zero in at most n/|F| points by the Schwartz-Zippel Lemma.
General Graphs vs Bipartite Ones • Wedon’thave a natural a priori way of partitioning a graph’svertices in labels and vertices of a labeledHamiltonicityinstance. • First idea: wecanusesubsets (not just singletons) of a label set to label the edges in a labeledcycle cover. • Wewilluse a randomequipartitioning of the vertices. • Problem: Wecannotlabeledges with the empty set. • Second idea: weadd a fewlabels on everydirectedge.
Subset Labeled Hamiltonicity 1 A B L’={a,b} {a} {b} {AD} {AB} {a} {ADE} {b} 2 1 3 2 3 C {BADE} {C} 5 {C} {B} 4 D {a} {DE} {b} 4 5 {E} {BADE} {C} E n’=n/2=5 vertices n=10 vertices |L|=n/2+|L’|=7 edgelabels
HowManyDirectEdgeLabels are Needed? • Consider a fixedHamiltoniancycle H. • Ifwechoose an equipartition of the input graphsvertices and usehalf of them as vertices in a subset labeledHamiltonicityinstance, we get n/4 directedges in expectationalong H. • Weneed in total n/2+n/4=3n/4 labels. • Can we still find a O*(2|L|) time algorithm for Subset LabelHamiltonicity?
GoingExponential • Instead of onematrix per label, weimagineonematrix TX per label subset X. • Now gives uswhatwewant.
Computing • Wecanuse a recursion like the Bellman-Held-Karp-Gonzalezdynammicprogramming to compute all matrices TX in O*(2n-n’) time. • Wecanuse 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. • Wecantrade a fewlabels for a modest exponentialnumber of runs to get an O*(1.657n) time algorithm. • Wecanusewalksinstead of paths in the labels’ construction getting a polynomialspacealgorithm with the same running time. • By adjoining a new indeterminatewecanembed a min-sum semiring in the polynomial and solve for TSP.
Another RelatedTechnique (Joint work with Husfeldt, Kaski, and Koivisto) • Idea: Count labeledwalksinstead of labeledcycle covers. • Wedon’tneed determinants. • Previousreductions from Hamiltonicity to Subset Labeled Hamiltonicity still in play.
Labeled Walks 2 B C C B F F B,D,E A 5 1 4 3 A E D D E 6 +
WhyLabel at All? 2 5 1 4 3 6 Countedonlyonce!
Aha! Just don’tBacktrack 2 5 1 4 3 6 1->6->3->4->6->3->1 1->6->4->3->6->3->1
Whataboutk-Path? • Given undirectedgraph G=(V,E) and positive integer k, determineifthere is a simple path of length k in G. • Just countlabeledwalks of length k’ instead of closedlabeledwalks of length n’. • Thenweonlyneed 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 wefindotherk-vertexsubgraphs faster with labelingtechniques? • Can wederandomize the bipartiteHamiltonicityalgorithm? • Is characteristictwoessential?