Hamiltonian Cycles

advertisement
HAMILTONIAN CYCLES
Vesal Hakami
October 30, 2010
Hamiltonian Cycles Demystified
• Brief History
• Basic Definitions, Initiatives, Sufficient
Conditions, A Backtracking Algorithm
• Chiba & Nishezeki’s Linear
Implementation for Internally 4Connected Plane (I4CP) Graphs (Journal
of Algorithms, 1989 – Elsevier)
2
History
• Icosian game invented by Sir. William Rowan Hamilton (1805–
1865) in 1857 and sold to a London game dealer in 1859 for 25
pounds.
• Game Description: The corners of a
regular dodecahedron are labeled
with the names of cities; the task is
to find a circular tour along the
edges of the dodecahedron visiting
each city exactly once.
• Solution Model: Hamiltonian cycle;
i.e. look for a cycle in the
corresponding dodecahedral graph
which contains each vertex exactly
once.
The Platonic Solid used in Icosian game;
the corresponding Hamiltonian cycle is
designated by darkened edges.
3
Basic Definitions
• Hamiltonian Cycle: If G = (V, E) is a graph or multi-graph with |V|>=3,
we say that G has a Hamiltonian cycle if there is a cycle in G that
contains every vertex in V.
• Hamiltonian Path: A Hamiltonian path is a path
(and not a cycle) in G that contains each vertex. It
is possible, however, for a graph to have a
Hamiltonian path without having a Hamiltonian
cycle.
Hamiltonian path ๏
Hamiltonian cycle
๏
Remarks:
• There is no helpful connection between the idea of Eulerian circuits (or
trails) and Hamiltonian cycles (or paths).
• There do not exist necessary and sufficient* conditions on a graph G
that guarantee the existence of a Hamiltonian cycle (path).
• One may resort to trial and error for particular graphs along with a
number of helpful observations.
* Necessary
and Sufficient Conditions for Hamiltonian based on Linear Diophantine Equation Systems
with Cycle Vector, 2009 3rd Intl. Conf. on Genetic and Evolutionary Computing.
4
Example I- A Connected Graph with no Cycle of
Odd Length
• Does G contain a Hamiltonian path?
• Starting from vertex a, alternatively label each vertex and its
adjacents with x’s and y’s. If G is to have a Hamiltonian path, there
must be an alternating sequence of five x's and five y's.
• Recall: A graph G = (V, E) is bipartite iff it contains no cycle of odd
length.
๏ƒ
G (no cycle of odd
length)
x-y vertex labeling
4 x’s and 5 y’s→ No Hamiltonian path
G is, in fact, a
bipartite graph
5
Helpful Hints on Finding Hamiltonian Cycles
The complete graph Kn is Hamiltonian.
If G = (V, E) has a Hamiltonian cycle, then for all v ∈ V, deg(v) ≥ 2.
If a ∈ V and deg(a) = 2, then the two edges incident with vertex a must
appear in every Hamiltonian cycle for G.
If a ∈ V and deg(a) > 2, then as we try to build a
Hamiltonian cycle, once we pass through
vertex a, any unused edges incident with a are
deleted from further consideration.
In building a Hamiltonian cycle for G, we cannot
obtain a cycle for a sub-graph of G unless it
contains all the vertices of G.
6
Example II- Tournament Graphs
•
Theorem. A complete digraph ๐พ๐‘›∗ (called a tournament)- in which for each
•
Proof:
•
•
•
distinct pair x, y of vertices, exactly one of the edges (x, y) or (y, x) is in ๐พ๐‘›∗ always contains a (directed) Hamiltonian path.
Let m ≥ 2 with Pm a path containing the m-1
edges (v1, v2), (v2, v3), .... (vm-1, vm).
if m = n, we're finished.
If not,
– let v be a vertex that does not appear in Pm.
– If (v, v1) is an edge in ๐พ๐‘›∗ , we can extend Pm by adjoining this edge.
– If not,
•
•
•
•
(v1, v) must be an edge.
Suppose that (v, v2) is in the graph.
We have the larger path: (v1, v), (v, v2), (v2, v3), ..., (vm-1, vm).
If (v, v2) is not an edge in ๐พ๐‘›∗ , then (v2, v) must be.
– Continue this process; there are only two possibilities:
• (a) For some 1 ≤ k ≤ m-1, the edges (vk, v), (v, vk+1) are in ๐พ๐‘›∗ and we replace (vk,
vk+1) with this pair of edges.
• (b) (vm, v) is in ๐พ๐‘›∗ and we add this edge to Pm.
• Either case results in a path Pm+1 that includes m+1 vertices and has m edges.
– Repeat this process until we have a path Pn on n vertices.
7
Hamiltonian Path: Sufficient Condition
• Theorem. Let G= (V, E) be a loop-free graph with |V|= n ≥ 2. If
deg(x) + deg(y) ≥ n - 1 for all x, y ∈ V, x ≠ y, then G has a
Hamiltonian path.
• Proof.
•
•
I) Connectivity (Proof by Contradiction): G consists of two components C1
(|C1| = n1) and C2 (|C2| = n2). Let x ∈ C1 and y ∈ C2. Obviously, deg(x) ≤ n1 - 1
and deg(y) ≤ n2 - 1; that is, deg(x) + deg(y) ≤ (n1 + n2) – 2 ≤ n - 2,
contradicting the condition given in the theorem; thus, G is connected.
II) Hamiltonian path construction:
– For m ≥ 2, let Pm be the path {v1, v2}, {v2, v3}, ... , {vm-1, vm} of length m - 1.
– If v1 is adjacent to any vertex v other than v2, v3, ..., vm, we add the edge
{v, v1} to Pm to get Pm+1.
– The same procedure is carried out if vm is adjacent to a vertex other than
v1, v2, ..., vm-1.
– If we are able to enlarge Pm to Pn in this way, we get a Hamiltonian path.
8
Hamiltonian Path: Sufficient Condition- Ctd.
•
Otherwise,
– Pm: {v1, v2}, ..., {vm-1, vm} has v1 and vm adjacent only to vertices in Pm and m < n.
– Now, we claim that G has a cycle on these vertices:
• If v1 and vm are adjacent, then the cycle is {v1, v2}, {v2, v3}, ..., {vm-1, vm}, {vm, v1}.
• Otherwise,
– v1 is adjacent to a subset S of the vertices in {v2, v3, ..., vm-1}.
– If there is a vertex vt ∈ S such that vm is adjacent to vt-1, then we can get the
cycle by adding {v1, vt}, {vt-1, vm} to Pm and deleting {vt-1, vt}, as shown in Fig.
(a).
Fig. (a)
– If not,
» Let |S| = k < m - 1.
» Then, deg(v1) = k and deg(vm) ≤ (m - 1) - k
» Contradiction! deg(v1) + deg(vm) ≤ m - 1 < n - 1.
– Hence, there is a cycle connecting v1, v2, ..., vm.
9
Hamiltonian Path: Sufficient Condition- End.
•
•
Now, consider a vertex v ∈ V that is not found on this cycle.
G is connected, so there is a path from v to a first vertex vr in the cycle, as shown in Fig. (b).
Fig. (b)
•
•
Removing the edge {vr-1, vr} (or {v1, vt} if r = t), we get the path (longer than the original Pm)
show in Fig. (c).
Repeating this whole process for the path in Fig. (c), we continue to increase the length
until it includes every vertex of G.
Fig. (c)
Corollary.
The loop-free graph G = (v, E) with |V| ≥ 2 has a Hamiltonian path if deg(v) ≥ (n - 1)/2
for all v ∈ V.
10
Hamiltonian Cycle: Sufficient Condition- Ore (1960)
• Theorem. Let G= (V, E) be a loop-free graph with |V|= n ≥ 3. If
deg(x) + deg(y) ≥ n for all x, y ∈ V, x ≠ y, then G has a
Hamiltonian cycle.
• Proof.
• Assume that G does not contain a Hamiltonian cycle.
• We add edges to G until we arrive at a sub-graph H of Kn, where H
has no Hamiltonian cycle, but, for any edge e (of Kn) not in H, H + e
does have a Hamiltonian cycle.
• Since H ≠ Kn, there are vertices a, b ∈ V, where {a, b} is not an
edge of H but H + {a, b} has a Hamiltonian cycle C.
• The graph H has no such cycle, so the edge {a, b} is a part of cycle
C.
• The vertices of H (and G) on cycle C are as follows:
11
Hamiltonian Cycle: Sufficient Condition- Ore
(1960)- End.
• For each 3 ≤ i ≤ n, if the edge {b, vi} is in the graph H,
– then we claim that the edge {a, vi-1} cannot be an edge of H.
• If both of these edges are in H, for some 3 ≤ i ≤ n,
– we get the Hamiltonian cycle:
for the graph H (which has no Hamiltonian cycle).
•
•
Therefore, for each 3 ≤ i ≤ n, at most one of the edges
{b, vi}, {a, vi-1} is in H.
Consequently,
๐‘‘๐‘’๐‘”๐ป ๐‘Ž + ๐‘‘๐‘’๐‘”๐ป ๐‘ < ๐‘›
• Since for all v ∈ V, ๐‘‘๐‘’๐‘”๐ป ๐‘ฃ ≥ ๐‘‘๐‘’๐‘”๐บ ๐‘ฃ = deg(๐‘ฃ), so we
have nonadjacent (in G) vertices a, b, where
๐’…๐’†๐’ˆ ๐’‚ + ๐’…๐’†๐’ˆ ๐’ƒ < ๐’
CONTRADICTION!
12
Hamiltonian Cycle: Ore’s Sufficient Condition
Corollaries
• Corollary I. If G = (V, E) is a loop-free undirected graph with |V|
= n ≥ 3, and if deg(v) ≥ n/2 for all v ∈ V, then G has a
Hamiltonian cycle.
• Corollary II. If G = (V, E) is a loop-free undirected graph with |V|
= n ≥ 3, and if |๐‘ฌ| ≥ ๐’−1
+ 2 , then G has a Hamiltonian cycle.
2
• Proof.
• Let a, b ∈ V, where {a, b} is not in E. [Since a, b are nonadjacent,
we want to show that deg(a) + deg(b) >= n.]
• Remove the vertices a and b together with all edges incident on
them from the graph G.
• Let H = (V', E') denote the resulting sub-graph.
• |E| = |E'| + deg(a) + deg(b) because {a, b} is not in E.
13
Hamiltonian Cycle: Ore’s Sufficient Condition
Corollaries- End.
• Since |V'| = n - 2, H is a sub-graph of the complete graph Kn-2, so
n−2
๐ธ ≤
2
′
• Consequently,
n−1
n−2
′
+ 2 ≤ ๐ธ = ๐ธ + deg ๐‘Ž + deg ๐‘ ≤
+ deg ๐‘Ž + deg (๐‘)
2
2
• and we find that:
14
Hamiltonian Cycle: Backtracking Algorithm
• State space tree:
– The initial node in level 0
– All the remaining n-1 nodes in levels 1, 2, …, n-1
– The number of state space tree nodes:
2
1 + n − 1 + (๐‘› − 1) + โ‹ฏ + ๐‘› − 1
๐‘›−1
(๐‘› − 1)๐‘› −1
=
๐‘›−2
• Promising nodes’ characterization:
– The ith node on the path must be adjacent to (i-1)th node
– (n-1)th node must be adjacent to node 1 (initial node)
– The ith node cannot be one of the first i-1 nodes
• Inputs:
– A positive integer n (Number of vertices)
– An undirected graph G with n vertices and with adjacency matrix
denoted by the 2D array W
• Output:
– The Hamiltonian cycle denoted by the linear array vindex
• vindex [i] is the index of the ith node on the cycle.
• The Index of the initial node is located in vindex [0].
15
Hamiltonian Cycle: Backtracking Algorithm- End.
• High level call:
– vindex[0] = 1;
– hamiltonian(0);
void promising (index i)
{
index j;
bool switch;
if ( i == n – 1 && ! W[vindex[n – 1]] [vindex[0]])
switch = false;
else if (i > 0 && ! W[vindex[i -1]] [vindex[i]])
switch = false;
else {
switch = true;
j = 1;
while (j < i && switch) {
if (vindex[i] == vindex[j])
switch = false;
j++;
}
}
return switch;
void hamiltonian (index i)
{
index j;
if (promising(i))
if (i == n – 1)
cout << vindex[0] through vindex[n – 1];
else
for (j = 2; j <= n; j++) // Try all vertices
{
// as next one.
vindex[i + 1] = j;
hamiltonian(i+1);
}
}
// First vertex must
// be adjacent to
// last. ith vertex
// must be adjacent
// to (i – 1)th.
// Check if vertex is
// already selected.
}
16
CHIBA &
NISHIZEKI’S
LINEAR
IMPLEMENTATION
FOR I4CP GRAPHS
17
Chiba & Nishizeki’s Algorithm- Overview
• The Hamiltonian cycle problem is NP-complete
even for 3-connected planar graphs.
• Tutte proved that a 4-connected planar (4CP)
graph necessarily contains a Hamiltonian cycle
and that It can be found in polynomial time.
• Prior art for 4CP graphs:
– An O(n3) algorithm
– A linear algorithm for 4-connected “maximal” planar
graphs
• Objective
– A linear algorithm for finding a Hamiltonian cycle
in general 4CP graphs
18
Chiba & Nishizeki’s Algorithm- Overview
• Solution methodology
– Divide & Conquer with inductive argument:
• Decompose a graph into several small sub-graphs,
then find Hamiltonian cycles in sub-graphs by applying
the inductive hypothesis to them, and finally combine
the Hamiltonian cycles into a Hamiltonian cycle of the
whole graph.
• Since the decomposed graphs are not always edgedisjoint, it was non-trivial to verify even the
polynomial bounded-ness of the algorithm.
– Key idea:
• Avoid the decomposition into non-disjoint sub-graphs.
19
Required Terms and Definitions
• Cut-vertex: a vertex whose deletion increases the number of
components.
• Separation pair: a separation pair of a 2-connected graph G
is two vertices whose deletion disconnects G.
• Splitting: Dividing a graph G into two split graphs G1 and G2.
• Merging: the inverse of splitting
• Virtual edge: The edge {x, y} in G1 or G2 whether it originally
exists in G1 and G2 or is newly added to G1 and G2.
• Separation triple: a separating set of three vertices.
• 4-connected graph: a 3-connected graph with no separation
triples.
• Block: A block of G is a maximal 2-connected sub-graph of G.
20
Thomassen’s Result from Tutte’s Theorem
Lemma. Let G be a 2-connected plane graph with the outer facial cycle Z.
Let s and e = (a, b) be a vertex and an edge, both on Z, and let t be any
vertex of G distinct from s. Then G has a path P (called a Tutte path) going
from s to t through e such that
– (i) each component of G - P is adjacent to at most three vertices of P, and
– (ii) each component of G - P is adjacent to at most two vertices of P if it
contains an edge of Z.
Remark I. The above lemma implies that a 4-connected planar graph G has a
Hamiltonian cycle.
21
Thomassen’s Result from Tutte’s Theorem- End.
• Remark II.
Let G be a 4-connected and P be a s, t - Tutte path
in G. Suppose H is a (G - P)-component then, since G is 4connected, H must have 4 vertices of attachment in P which is a
contradiction because P is a Tutte path.
• Remark III. In a 4-connected planar graph G: Let s and t
be two adjacent vertices on Z and let e ≠ (s, t) be an edge on
Z, then the path P joining s and t through e, assured by the
Lemma, must be a Hamiltonian path of G, so P + (s, t) must
be a Hamiltonian cycle of G. Thus an algorithm for finding
the s-t path P immediately yields an algorithm for finding a
Hamiltonian cycle.
• Decomposition strategy
– The original graph G is 4-connected.
– The sub-graphs into which G is decomposed are no longer
4-connected.
– They inherit the “internally 4-connected (I4C)” property. 22
Internally 4-Connected Plane (I4CP) Graphs
• The I4C property
•
•
•
Intuitively, a graph is internally 4-connected if it contains no separation
pair or triple in the interior.
Formal definition: Let G be a 2-connected plane graph with outer facial
cycle Z. Let s and t be two distinct vertices on Z, and let e = (a, b) be an
arbitrary edge on Z such that e ≠ (s, t). t ≠ a , b and vertices s, a, b and t
appear clockwise on Z in this order. (Fig. (a).)
Possibly s = a as illustrated in Fig. (b). Let r be the vertex on Z
counterclockwise next to s, and let f = (r, s) be the edge joining r
and s.
23
Internally 4-Connected Plane (I4CP) Graphs- End.
• A plane 2-connected graph G
is internally 4-connected with
respect to (s, t, e) if G satisfies
the following two conditions:
(a) If {x, y} is a separation
pair, then
(i) every component of
G - {x , y} contains at
least one vertex of Z
(ii) each of the three
paths Psa, Pbt and Pts
contains at most
one of x and y.
(b) If {x, y, z} is a separation
triple, then every component
of G - {x, y, z} contains at
least one vertex of Z.
(c), (d) and (e) violate conditions in (a).
(f) violates condition (b).
24
Type I Reduction Using Vertical Separation Pairs:
๐‘ฎ → ๐‘ฎ๐’ ๐š๐ง๐ ๐‘ฎ๐’“
• Vertical separation pair:
a separation pair {x, y} is
called vertical if
either
x ∈ Psa- s and y ∈ Pbr
or
x = s and y ∈ Pbt – t.
• Type I Reduction: G is
decomposed into two
sub-graphs w.r.t. a
vertical separation pair.
• {y’, z’} is a horizontal
separation pair.
25
Type II Reduction: ๐‘ฎ → ๐‘ฎ๐’ƒ , ๐‘ฎ๐Ÿ๐’ˆ , ๐‘ฎ๐Ÿ‘๐’– and ๐‘ฎ๐Ÿ’๐’ˆ
๐‘ฎ๐Ÿ๐’ˆ
• Let G be an I4CP graph having
no vertical separation pair,
then G is decomposed into
several sub-graphs, called ๐‘ฎ๐’ƒ ,
๐‘ฎ๐Ÿ๐’ˆ , ๐‘ฎ๐Ÿ‘๐’– and๐‘ฎ๐Ÿ’๐’ˆ . (If S = a, G is
๐‘ฎ๐’ƒ
๐Ÿ
decomposed into ๐‘ฎ๐’ƒ and ๐‘ฎ๐’ˆ .)
G
๐‘ฎ๐Ÿ‘๐’–
๐‘ฎ๐Ÿ’๐’ˆ
26
Type II Reduction- ๐‘ฎ๐’ƒ , ๐‘ฎ๐Ÿ๐’ˆ
• ๐‘ช๐’ƒ : the block of G – Psa which contains t. (๐‘ช๐’ƒ is crosshatched.)
• ๐‘ช๐’ƒ must entirely contain Pbr,
otherwise G would contain a
vertical separation pair.
• Repeat splitting of ๐‘ช๐’ƒ at
every separation pair such
that one of the two split
graphs entirely contains Pbr.
• The component containing
Pbr is called Gb, while each of
the others is called ๐‘ฎ๐Ÿ๐’ˆ
where g = (x, y) is a virtual
edge contained in the
component.
๐‘ฎ๐Ÿ๐’ˆ
๐‘ฎ๐’ƒ
27
Type II Reduction-
๐Ÿ‘
๐‘ฎ๐’–
• ๐‘ช๐’– : maximal sub-graph of G – ๐‘ท๐’”๐’‚ which can be
separated from ๐‘ช๐’ƒ at each cut-vertex u.
• ๐‘ช๐Ÿ‘๐’– : the sub-graph of G induced by the vertices of ๐‘ช๐’– and
the vertices on Psa which are adjacent to ๐‘ช๐’– .
• Let x (resp. y) be the vertex of ๐‘ท๐’”๐’‚ ∩ ๐‘ช๐Ÿ‘๐’– which is nearest
to s (resp. a) along ๐‘ท๐’”๐’‚ . Add a new edge e’ = (u, y) to if it
does not exist, and let ๐‘ฎ๐Ÿ‘
๐’– be the resulting graph.
๐‘ฎ๐Ÿ‘๐’–
28
Type II Reduction- ๐‘ฎ๐Ÿ’๐’ˆ
• ๐‘ฎ๐Ÿ’๐’ˆ : schematically, ๐‘ฎ๐Ÿ’๐’ˆ is a graph formed by merging ๐‘ฎ๐Ÿ๐’ˆ with all the ๐‘ฎ๐Ÿ๐’ˆ′ and
๐‘ช๐Ÿ‘๐’– drawn above ๐‘ฎ๐Ÿ๐’ˆ .
•
Constructively, ๐‘ฎ๐Ÿ’๐’ˆ is defined as:
๐‘ช๐Ÿ’๐’ˆ := ๐‘ฎ๐Ÿ๐’ˆ ;
while ๐‘ช๐Ÿ’๐’ˆ has a virtual edge g’ ≠ g, iterate to merge ๐‘ฎ๐Ÿ๐’ˆ′ into ๐‘ช๐Ÿ’๐’ˆ ;
for each cut-vertex u (≠ x, y) of G – Psa contained in ๐‘ช๐Ÿ’๐’ˆ merge ๐‘ช๐Ÿ‘๐’– to ๐‘ช๐Ÿ’๐’ˆ ;
Construct the sub-graph of G induced by the
vertices of ๐‘ช๐Ÿ’๐’ˆ together with the vertices of Psa
adjacent to ๐‘ช๐Ÿ’๐’ˆ , and redefine ๐‘ช๐Ÿ’๐’ˆ as the sub-graph;
– ๐‘ฎ๐Ÿ’๐’ˆ โ‰” ๐‘ช๐Ÿ’๐’ˆ - x – y.
–
–
–
–
๐‘ฎ๐Ÿ’๐’ˆ๐Ÿ
29
Type II Reduction Maintains the I4C Property
• Lemma. Let G be an I4CP graph containing no vertical separation
pair. Then, all the decomposed graphs ๐‘ฎ๐’ƒ , ๐‘ฎ๐Ÿ๐’ˆ , ๐‘ฎ๐Ÿ‘๐’– and ๐‘ฎ๐Ÿ’๐’ˆ are I4C
w.r.t. (s’ , t’ , e’) if s’ , t’ , e’ are defined as follows:
- Case ๐‘ฎ ๐’ƒ
๐‘ฎ๐’ƒ
s’ = b
t’ = t
e’ =
if t ≠ r
the edge clockwise incident
to r on the outer facial cycle
of Gb.
If t = r
the edge counterclockwise
incident to b.
30
Type II Reduction Maintains the I4C Property- Ctd.
– Case ๐‘ฎ๐Ÿ๐’ˆ
s’ = y
t’ = x
e’ = the edge counterclockwise incident to y
on the outer facial cycle of ๐‘ฎ๐Ÿ๐’ˆ .
๐‘ฎ๐Ÿ๐’ˆ
– Case ๐‘ฎ๐Ÿ‘๐’–
s’ = u
t’ = x
e’ = (u, y).
๐‘ฎ๐Ÿ‘๐’–
– Case ๐‘ฎ๐Ÿ’๐’ˆ
s’ = w
t’ = v
e’ =
if w’ ≠ v’
an arbitrary edge on outer path Pw’v’.
If w’ = v’
an arbitrary edge on Pwv incident to w’ (= v’).
๐‘ฎ๐Ÿ’๐’ˆ
31
Type II Reduction Maintains the I4C Property- End.
• Proof. We verify only the case ๐‘ฎ๐Ÿ’๐’ˆ . Suppose ๐‘ฎ๐Ÿ’๐’ˆ is not I4C w.r.t. (s’ , t’ , e’).
Then, ๐‘ฎ๐Ÿ’๐’ˆ must have one of the following three:
– a cut-vertex vc.
– A separation pair {vp1, vp2} such that both vp1 and vp2 are contained in path
Pwa’ or Pbv’; and
– a separation triple {vt1, vt2, vt3} for which one of the components of ๐‘ฎ๐Ÿ’๐’ˆ - {vt1,
vt2, vt3} contains no vertex of the outer facial cycle Z’ of ๐‘ฎ๐Ÿ’๐’ˆ .
• In either case, G would contain a separation triple {vc, x, y}, {vp1, vp2, vx},
{vp1, vp2, y}, or {vt1, vt2, vt3} such that the deletion of the triple from G
produces a component containing no vertex of Z. This contradicts the
I4C-ness of G.
G
๐‘ฎ๐Ÿ’๐’ˆ
32
An I4C graph w.r.t. (s, t, e) contains a Hamiltonian
path connecting s and t through e
• Lemma. Let G be a plane graph having an outer facial
cycle Z. Let s and t be two distinct vertices on Z and let
e(≠ (s , t) ) be an edge on Z . If G is I4C w.r.t. (s, t, e),
then G has a Hamiltonian path P(G, s, t, e) which
connects s and t and contains e. Moreover, if G has no
vertical separation pair, then P(G, s, t, e) does not
contain edge f = (s, r).
• Proof. The proof is by induction on the number n of
vertices of a graph G. If n = 3, the claim is clearly true,
so we assume that n > 3. There are two cases to
consider.
– There exists a vertical separation pair {x, y}
– G has no vertical separation pairs.
33
An I4C graph w.r.t. (s, t, e) contains a Hamiltonian
path connecting s and t through e - Ctd.
• Case 1: There exists a vertical separation pair {x, y}.
– Among all vertical separation pairs of G, we choose {x, y} such
that Gr has the smallest number of vertices. We call such a
separation pair the rightmost separation pair.
– Consider the case t ∈ GI * as shown in Fig.
• Let e’ = (x, y) be a virtual edge.
Clearly, Gl is I4C w.r.t. (s, t, e’), while Gr
is I4C w.r.t. (x, y, e) (or w.r.t. (y, x, e) if
y = b).
• By the inductive hypothesis, Gl has
a Hamiltonian path P(Gl , s, t, e’)
and Gr has P(Gr , x, y, e).
• G has a Hamiltonian path:
P(G , s, t, e) = P(Gl , s, t, e’) + P(Gr , x, y, e) – e’
or P(Gl , s, t, e’) + P(Gr , y, x, e) – e’
* The case t ∈ GI is handled with a similar understanding.
34
An I4C graph w.r.t. (s, t, e) contains a Hamiltonian
path connecting s and t through e - End.
• Case 2: G has no vertical separation pair.
– By the inductive hypothesis, all the decomposed graphs ๐‘ฎ๐’ƒ , ๐‘ฎ๐Ÿ๐’ˆ , ๐‘ฎ๐Ÿ‘๐’– and
๐‘ฎ๐Ÿ’๐’ˆ have Hamiltonian paths. From them, a Hamiltonian path
P(G , s, t, e) of G can be constructed as follows
(Note that edge f = (s, r) is never included in path P):
First set P to Psb + P(Gb , b, t, e’).
While there is a virtual edge g = (x, y) in Gb
If g ∈ P, then
P : = P – g + P(๐‘ฎ๐Ÿ๐’ˆ , y, x, e’). (replace g of P by a H-path of ๐‘ฎ๐Ÿ๐’ˆ)
Merge ๐‘ฎ๐Ÿ๐’ˆ into Gb ;
If g ∈ p, then
Construct ๐‘ฎ๐Ÿ’๐’ˆ , and set P := P – Pvw + P(๐‘ฎ๐Ÿ’๐’ˆ , w, v, e’),
Delete g from Gb .
For each u of the cut-vertices of G – Psa contained in Gb
Set P := P – Pxy + P(๐‘ฎ๐Ÿ‘๐’– , u, x, (u, y)) - (u, y).
35
An Abstract Example
If g1 is on P(Gb , b, t, e’), then:
๐‘ฏ − ๐‘ท๐‘จ๐‘ป๐‘ฏ ๐’Š๐’” ๐’„๐’๐’๐’”๐’•๐’“๐’–๐’„๐’•๐’†๐’… ๐’‡๐’“๐’๐’Ž:
๐‘ฎ๐’ƒ , ๐‘ฎ๐Ÿ๐’ˆ๐Ÿ , ๐‘ฎ๐Ÿ‘๐’–๐Ÿ’ , ๐‘ฎ๐Ÿ‘๐’–๐Ÿ“ , ๐‘ฎ๐Ÿ‘๐’–๐Ÿ” and ๐‘ฎ๐Ÿ’๐’ˆ๐Ÿ
36
A Concrete Example
G
๐‘ฎ๐’ƒ
๐‘ฎ๐Ÿ๐’ˆ → ๐‘ฎ๐Ÿ(๐Ÿ,๐Ÿ‘) , ๐‘ฎ๐Ÿ(๐Ÿ‘,๐Ÿ“) , ๐‘ฎ๐Ÿ(๐Ÿ“,๐Ÿ•)
๐‘ฎ๐Ÿ‘๐’– → ๐‘ฎ๐Ÿ‘๐Ÿ , ๐‘ฎ๐Ÿ‘๐Ÿ” , ๐‘ฎ๐Ÿ‘๐Ÿ’
๐‘ฎ๐Ÿ’๐’ˆ → ๐‘ฎ๐Ÿ’(๐Ÿ‘,๐Ÿ“)
37
A Concrete Example- Ctd.
38
A Concrete Example- End.
– In the previous slide,
– The path passes through
the virtual edge (1, 7), so
a Hamiltonian path of
๐Ÿ
๐†(๐Ÿ,๐Ÿ•)
is determined.
– The path passes through
the virtual edges (1, 3)
and (5, 7) but not (3, 5),
so the Hamiltonian paths
๐Ÿ
๐Ÿ
of ๐†(๐Ÿ,๐Ÿ‘)
, ๐†๐Ÿ๐Ÿ‘ , ๐†(๐Ÿ“,๐Ÿ•)
, ๐‘ฎ๐Ÿ‘๐Ÿ”
๐Ÿ’
and ๐†(๐Ÿ‘,๐Ÿ“)
are determined.
S- t Hamiltonian path
39
The HPATH Algorithm of O(n2)
procedure HPATH(G, s, t , e);
begin
if G contains exactly three vertices
then {G is a triangle}
return a (trivial) Hamiltonian path P(G, s, t, e);
else if G has a vertical separation pair
then Type I reduction
else Type II reduction
end;
Time Complexity Analysis
• Lemma. There are at most n-3 reductions during one execution of
algorithm HPATH.
• Theorem. The algorithm HPATH spends at most O(n2) time.
40
Time Complexity Analysis- Ctd.
• Proof.
• r: the number of reductions occurred during one
execution of HPATH.
• d(i), 1 ≤ i ≤ r: the number of small graphs into which
a graph is decomposed at the ith reduction; i.e. d(i) is
the number of the recursive calls which occurred at
the reduction.
d(i) =
2
if the ith reduction is of Type I
1
if the ith reduction is of Type II and none of
๐‘ฎ๐Ÿ๐’ˆ ,๐‘ฎ๐Ÿ’๐’ˆ and ๐‘ฎ๐Ÿ‘๐’– is produced.
• r': the number of reductions with d = 1
• t: the number of final triangles
41
Time Complexity Analysis- Ctd.
• Upper bound on the number of reductions in the
recursive call tree:
– Internal nodes ๏ƒŸ๏ƒ  Reductions
– Children of internal nodes ๏ƒŸ๏ƒ  Recursive calls at the
reduction
– Leaves ๏ƒŸ๏ƒ  Final triangles
• The tree has:
– t leaves
– r internal nodes (r' of which have out-degree 1)
• Recall:The number of internal nodes in a binary tree is
one less than the number of leaves.
• The recursive tree has at most t - 1 internal nodes of
out-degree 2 or more; thus, we have:
r ≤ t – 1 + r’
(1)
42
Time Complexity Analysis- Ctd.
• Upper bound for the total length of paths found in
triangles:
– A Type I reduction increases by one the total length of paths
which will be found in the two reduced graphs.
– In general, the ith reduction increases by d(i) – 1 the total
length of paths which will be found in the d(i) reduced graphs.
– Conversely, if d(i) = 1, then the length of a path which will be
found in the reduced graph decreases by at least one.
– HPATH initially wishes to find a Hamiltonian path of length
n – 1. Therefore, the upper bound for the total length of
paths found in triangles is:
๐’… ๐’Š − ๐Ÿ − ๐’“′ = ๐’ − ๐Ÿ + ๐’“ + ๐’• − ๐Ÿ − ๐’“ − ๐’“′
๐’−๐Ÿ+
๐Ÿ≤๐’Š≤๐’“
= ๐‘› + ๐‘ก − ๐‘Ÿ ′ − 2.
(2)
43
Time Complexity Analysis- End.
• The lengths of the Hamiltonian paths found
in the final triangles total 2t, we have:
2๐‘ก ≤ ๐‘› + ๐‘ก − ๐‘Ÿ ′ − 2.
• that is,
๐‘ก ≤ ๐‘› − ๐‘Ÿ ′ − 2.
(3)
• Combining (1) with (3), we get the claimed
bound on r:
r ≤ n – 3.
44
THE END
45
Download