HC is
NPC
G
consists of a series blocks
G
1
, . . .
G
n
(Fig (a)).
Each
G
i
corresponds a variable
.
G
i
is shown in Fig b, where
r
=
4
m
.
G
also has other vertices and edges (to be introduced later.)
There are exactly two possible paths from
d
i
to
d
i
+
1
which passes
through all vertices in
G
i
.
One path:
use the edge
(
d
i
,
a
i
,
1
)
(Fig (c))
. (Note that in this case, the
path must pass through the edge
(
a
i
,
4
j

2
,
a
i
,
4
j

1
)
for all
j
=
1
,
2
, . . .
.)
Another path:
use the edge
(
d
i
,
c
i
,
1
)
(Fig (d))
. (Note that in this case, the
path must pass through the edge
(
c
i
,
4
j

2
,
c
i
,
4
j

1
)
for all
j
=
1
,
2
, . . .
.)
Once the ﬁrst edge is chosen, the entire path is uniquely determined.
c
±
Xin He (University at Buffalo)
CSE 431/531 Algorithm Analysis and Design
4 / 27
HC is
NPC
So there are
2
n
Hamiltonian paths going through
G
,
corresponding to
2
n
possible truth assignments to the variables
x
i
, . . .
c
n
.
If a path enters
G
i
by
(
d
i
,
a
i
,
1
)
then
x
i
is assigned 1.
If a path enters
G
i
by
(
d
i
,
c
i
,
1
)
then
x
i
is assigned 0.
We next describe other vertices and edges in
G
.
G
has
m
other vertices
c
i
,
c
2
, . . . ,
c
m
. where
c
j
corresponds to the clause
C
j
in
F
.
If the clause
C
j
contains the variable
x
i
,
we add two edges from
c
j
to
a
i
,
4
j

2
and
a
i
,
4
j

1
.
If the clause
C
j
contains
¯
x
i
,
we add two edges from
c
j
to
c
i
,
4
j

2
and
c
i
,
4
j

1
.
Since
C
j
contains exactly 3 literals, the vertex
c
j
has degree 6 in
G
.
This completes the description of
G
.
c
±
Xin He (University at Buffalo)
CSE 431/531 Algorithm Analysis and Design
5 / 27