Documentation

CslibFrontier.Computability.Complexity.Problems.Hamiltonian.Undirected

From directed to undirected Hamiltonian paths and cycles #

Splitting every vertex of a directed graph into three reduces directed Hamiltonian cycles and paths to undirected ones: for cycles this is Karp's reduction [Kar72], for paths a variant of Sipser, Theorem 7.55. In Graph.split G, every declared vertex v of G becomes a path in(v) - mid(v) - out(v) (Graph.splitVertex G v r for r = 0, 1, 2), and every arc (u, v) of G becomes an edge out(u) - in(v). A middle vertex is adjacent only to the two other vertices of its gadget, so an undirected Hamiltonian path from in(s) to out(t) traverses every gadget from its entry to its exit, and the order of the gadgets is a directed Hamiltonian path from s to t; an undirected Hamiltonian cycle, read in a suitable direction, likewise traverses every gadget from its entry to its exit. Unlike Sipser's construction, the gadgets of s and t keep all three vertices, which treats the endpoints uniformly and covers s = t.

Vertices of the split graph are numbered by first occurrence in the vertex list, so repeated vertex entries share one gadget. An undeclared vertex gets labels that no declared vertex has: arcs with an undeclared endpoint become edges with an undeclared endpoint, which the undirected problems ignore, and an undeclared s or t makes both path instances negative. A self-loop (v, v) becomes the edge out(v) - in(v), so a single vertex with a self-loop, which is a directed Hamiltonian cycle, becomes a triangle.

Main definitions #

Main results #

References #

Vertex r of the gadget of v in Graph.split G: r = 0 is in(v), r = 1 is mid(v) and r = 2 is out(v). Vertices are numbered by their first occurrence in G.1, so an undeclared vertex gets the number G.1.length, which no declared vertex has.

Instances For

    The vertex-splitting graph of a directed graph G: every declared vertex v becomes a path in(v) - mid(v) - out(v), and every arc (u, v) becomes an edge out(u) - in(v).

    Instances For

      Gadget vertices are equal exactly when their vertices have the same first occurrence and their positions in the gadget agree.

      Gadget vertices of a declared vertex determine the vertex and the position in the gadget.

      The split graph lists three vertices for each declared vertex.

      The split graph lists two edges for each declared vertex and one for each arc.

      theorem Cslib.Complexity.Graph.mem_split_fst_iff {G : Graph} {x : ℕ} :
      x ∈ G.split.vertices ↔ ∃ v ∈ G.vertices, ∃ r < 3, x = G.splitVertex v r

      The declared vertices of the split graph are the gadget vertices of declared vertices.

      A gadget vertex is a declared vertex of the split graph exactly when its vertex is declared and its position is 0, 1 or 2.

      Adjacency in the split graph #

      Sequences of gadgets #

      Correctness of the reductions #

      theorem Cslib.Complexity.Graph.split_mem_HamPath_iff (G : Graph) (s t : ℕ) :
      { graph := G.split, source := G.splitVertex s 0, target := G.splitVertex t 2 } ∈ HamPath ↔ { graph := G, source := s, target := t } ∈ DirHamPath

      Vertex splitting preserves Hamiltonian paths. A directed graph has a Hamiltonian path from s to t exactly when its split graph has an undirected Hamiltonian path from in(s) to out(t).

      Vertex splitting preserves Hamiltonian cycles [Kar72]. A directed graph has a Hamiltonian cycle exactly when its split graph has an undirected Hamiltonian cycle.

      Polynomial-time reductions #

      The reduction from DirHamPath to HamPath: split the vertices of the graph, and ask for a path from the entry of s to the exit of t.

      Instances For