School of Computer, National University of Defense Technology,. ChangSha, P. R. ... This paper presents the full version
A Polynomial Time Algorithm for the Hamilton Circuit Problem Xinwen Jiang .etc** School of Computer, National University of Defense Technology, ChangSha, P. R. China, 410073 Abstract: In this paper, we introduce a so-called ‘Multistage graph Simple Path’ (MSP) problem and show that the Hamilton Circuit (HC) problem can be polynomially reducible to the MSP problem. To solve the MSP problem, we propose a polynomial algorithm and prove its NP-completeness. Our result implies NP=P. Key words: Algorithm, MSP problem, HC problem, NP complete problem
1. Introduction The Hamilton Circuit problem is a well-known NP-complete problem [1]. This famous problem can be described as follows: Given an undirected graph G=(V, E), does G have a Hamilton Circuit, i.e., a circuit visiting each vertex in V exactly once? This problem has attracted a mount of attention since it was born. However, no polynomial time algorithm has been designed until now,nor has a proof that this problem can not be solved in polynomial time been confirmed. A piece of recent work made by HP Lab's Vinay Deolalikar has caused much discussion, debate and comment on the Internet. He claimed that he had proved P≠NP, but unfortunately, there are some flaws in his proof [11]. This paper presents the full version of our idea to solve this famous problem. We will introduce a so-called ‘Multistage graph Simple Path’ (MSP) problem and prove its NP-completeness. To solve the MSP problem, we will propose a polynomial algorithm and prove its correctness. The following part of this paper includes 4 sections. (1) MSP problem and definitions (2) Z-H algorithm to solve MSP (3) Proving MSP∈NPC (4) Conclusions
2. MSP problem and definitions We begin with defining a kind of multistage graph.
**
Xinwen Jiang http://trytoprovenpvsp.blog.sohu.com/170695074.html 1
Definition 1 A labeled multistage graph G= is a directed graph with the following properties: (1) V is the vertex set of G. V=V0∪V1∪V2∪…∪VL, Vi∩Vj=Ø, 0≤ i, j ≤L, i≠j. If u∈Vi, 0≤i≤L, we say that u is a vertex of stage i, where L is the number of the stages of G. (Ø means empty in this paper) (2) E is the edge set of G. Any edge in E is a directed one. We use to represent an edge in E and say that is an edge of stage l. If ∈E, then u∈Vl-1,v∈Vl, where, 1≤l≤L. (3) V0 and VL have only one vertex. The vertex in V0 is named as S and the vertex in VL is named as D. (4) Each vertex v ∈V –{S} is labeled with E(v) that is a subset of E. We call E(v) as edge set of v.
(a)
(b)
Figure 1 Two Examples of labeled multistage graph
Example 1 The two graphs shown in Fig.1 are both labeled multistage graphs. In Fig.1(a), E(1)={e1}, E(2)={e2}, E(3)={ e1, e2, e3, e4}, E(4) ={ e1, e3, e5}, E(5) ={ e2, e4, e6}, E(6)={ e1, e3, e5, e10}, E(7) ={e12}, E(8) ={ e1, e3, e6, e8}, E(D)= { e1, e3, e5, e10,e12}. In Fig.1(b), E(1)= Ø, E(2)= Ø, E(3)= Ø, E(4) ={ e1, e3, e5}, E(5) ={ e2, e4, e6}, E(6)={ e1, e3, e5}, E(7) =E(7’)= { e1, e3, e6, e8}, E(8) ={ e1, e3, e6, e8}, E(D) = Ø. Definition 2 Let G= be a labeled multistage graph and S-u1-…-ul-…-uL (1≤l≤L, uL=D) be a path from S to D in G. S-u1-…-ul-…-uL is called a simple path in G if S-…-ul∈E(ul) for l∈ {1, 2, …, L} . S-u1-…-ul-…-uL is called a pre-simple path in G if S-…-ul∈E(ul) for l∈{1, 2, …, L-2}. For simplicity, we write S-…-v∈E(v) to denote that all the edges on S-…-v are contained in E(v). Now we propose a problem called ‘Multistage graph Simple Path’ (MSP) problem as follows. Given a labeled multistage graph G=, does G have a simple path, i.e., a path S-…-v -…-D such that S-…-v∈E(v) for all v on S-…-v-…-D except S? Some labeled multistage graphs contain simple path and others do not. For example, there is a simple path S- 1-3-4-6-D in Fig 1(a), while there is no simple path in Fig.1(b). As we know, the result of the famous TSP problem may be different if we change the weights of some edges rather than the basic structure of G. It is the same case for MSP problem. If we change E(v), the existence of a simple path may be changed even if we do not make any change to the basic structure of G. For example, if we change the value of E(v) in Fig.1(a) into E(1)={e1}, E(2)={e2}, E(3)={ e1, e2, e3, e4}, E(4) ={ e1, e3, e5}, E(5) ={ e2, e4, e6}, E(6)={ e1, e3, e5}, E(7) ={e12}, E(8) ={ e1, e3, e6, e8}, E(D)= {e1}, then the labeled multistage graph shown in Fig.1(a) has no simple path. MSP problem is to determine the existence of a simple path in a labeled multistage graph. Obviously, this problem is a NP problem. We can solve this problem on any NDTM easily, but we will give an algorithm which is totally different from exhausting algorithm on DTM to solve MSP problem in this paper. According to the definition of labeled multistage graph, an edge may appear in several E(v)’s. From the 2
definition of simple path, if S-u1-…-ul-1-ul-…-D (1≤l≤L, u0=S, uL=D) is a simple path, then ∈E(ul), E(ul+1), …, E(D). Definition 3 Let G= be a labeled multistage graph. If there exists a path v-v1-v2-…-vk -…-D in G such that ∈E(v), E(v1), E(v2), …, E(vk), …, E(D), we say that v-v1-v2-…-vk-…-D is a reachable path of from E(v) to E(D). All the reachable paths of form the reachable path set of . In this paper, we use R (u, v, l) to collect the edges on the reachable paths of , and use R(E) to denote {R (u, v, l) | ∈E}. It is worthy noting that R(u,v,l) is a set of edges rather than paths. Befor describing our algorithm to solve MSP problem, we firstly define four basic operators. v
Operator 1: [ ES ]u . Suppose ES E and u,v∈V. We define [ ES ]u ={e | e∈ES, e is on a path u-…-v, and all the edges on u v
-…-v are contained in ES}.
[ ES ]uv is defined to ‘tidy’ ES. Only those edges that are on some paths from u to v in ES are kept in [ ES ]uv . v
Let |E| be the number of the edges in E. The computation of [ ES ]u can be finished in O(|E|), since |ES| ≤ |E|. Operator 2: Init (R (u, v, l)). Init (R (u, v, l)) is to compute the initial value of R( u, v, l ). (1) ES ← { | ∈E, l is in / e1 / e2 /.../ e|E2 | , and Rini (aL 3 , aL 2 , L 2) contains aL-2– aL-1– D.
(a)
(b)
Figure 5 Typical graph of lemma 2
Proof: such that:
We summarize the main idea of the proof at first. To prove lemma 2, we need to construct a graph G1,
(1) G1, < a, S, 2>}, E(a)={< S0, a, 1>}, set / e1 / e2 /.../ e|E2 | ={}. (2) Add D-w-Dαβ in G, set E (w) =E(Dαβ)=(Comp(E(D), D, R(E) of G)∪{ , }. (3) For all vertices a at stage L+4-3 in Gαβ, set Rini (a, D, L 4 2) ={, , < a, S, 2>}. According to the construction of Gαβ, ESS=E(w)=E(Dαβ)=(Comp(E(D), D, R(E)) of G)∪{ , }, so, when we apply the proving algorithm on Gαβ, step 7 becomes useless. We have assumed that (Comp(E(D), D, R(E)) of G) ≠Ø after we applying Z-H algorithm on G, hence we know, after applying the proving algorithm on Gαβ, we will have (1) (Comp(ESS1, Dαβ, R(E)) of Gαβ)≠Ø, (2) / e1 / e2 /.../ e|E2 | ∩(Comp(ESS1, Dαβ, R(E)) of Gαβ) contains < a, S, 2>, such that [ R(a, S, 2)∩ D
(Comp(ESS1, Dαβ, R(E)) of Gαβ) ]S contains S – b1 – b2 – …– bL-3– bL-2– bL-1–D–w–Dαβ, in which D–w–Dαβ is contained in Rini (bL1 , D, L 2) . 29
Thus we know that there must exist a simple path in Gαβ by αβ lemma. Assuming that S0 – a – S – v1 – v2 – …– vL-1– D– w–Dαβ is a simple path in Gαβ, S – v1 – v2 – …–vL-1– D must be a simple path in G. ■
4.
Proving MSP∈NPC
We now concentrate ourselves on determining the Hamilton property of an undirected graph. For a given undirected graph G= of order n, we transform it into a labeled multistage graph G’ = according to the following six steps: (1) (2) (3) (4)
Let L=n Select vertex v from V. Generate vertices (v, 0), (v, n) in V’. Let S=(v, 0) and D=(v, n) For all u∈V- {v}, generate (u, 1) of stage l, (u, 2) of stage 2, …, (u, L-1) of stage L-1 in V’ For all (a, b)∈E, a≠v and b≠v, generate edges from previous stage to next stage in E’. These edges are ,…, and , …,. For all (v, b)∈E, generate edges from (v, 0) to (b, 1) and generate edges from (b, L-1) to (v, n) in E’. (5) Let E(u, l) = E’-{e | e∈E’ and e is associated with (u,1), …,or (u, l-1)}, 1≤l≤L-1. (6) Let E(D)=E(v, n)=E’ Step 5 is important. The edge set of (u, l) is assigned with a value that permits the appearance of u in stage l and forbids the appearance of u in those stages smaller than l . Theorem 4 Proof
G is a Hamilton graph if and only if G’ has a simple path from S to D.
If v–a1–a2–…–an-1–v is a Hamilton circle of G, (v,0) –(a1,1) –…– (an-1, n-1) – (v,n) must be a path in
G’. Since v, a1, a2, …, an-1 are mutually different, E(v,n) = E’, E(ai, i) = E’-{e | e∈E’ and e is associated with (ai,1), …,( ai, i-1)}, 1≤i≤n-1, therefore, we have E(v,n) contains (v,0) –(a1,1) –…– (an-1, n-1) – (v,n), E(ai, i) contains (v,0) – (a1,1) –…–(ai, i), where, 1≤i≤n-1. This means (v,0) – (a1,1) –…– (an-1, n-1) –(v,n) is a simple path in G’. On the other side, if (v,0) – (a1,1) –…– (an-1, n-1) – (v,n) is a simple path in G’, v–a1–a2–…–an-1–v must be a path which is from v to v in G. Since (v,0) – (a1,1) –…– (an-1, n-1) – (v,n) is a simple path, we know that v, a1, a2, …, an-1 are mutually different. This means that v–a1–a2–…–an-1–v is a Hamilton circle of G. ■ Theorem 5 Let G be a undirected graph of order n. The complexity of transforming G into G’ is a polynomial function of n. Proof: For vertex u in G, step 3 will generate n-1 vertices in G’. Hence step 3 will generate (n-1)*(n-1) vertices. For all edges in G, step 4 will generate 2*n edges in G’. Hence step 4 will generate 2n3 edges at most. We can finish step 5 in O(n5), since E(u, l) have 2n3 edges at most and the number of E(u, l) is no more than n2. The complexity of the algorithm is O(n5). ■
5.
Conclusions From all the discussion above, we have the following conclusion. 30
Theorem 6 There exists a polynomial time algorithm to solve MSP problem. There exists a polynomial time algorithm to solve Hamilton circuit problem. The most difficult thing in this paper is to prove that we can claim the existence of a simple path in G if Comp(E(D), D, R(E))≠Ø (that is Theorem 3). To do that, we proved Lemma 1, 2, 3, 4, 5 firstly. Then we proved αβ lemma based on Lemma 1, 2, 3, 4, 5. And finally we used αβ lemma to prove Theorem 3.
Figure 11 The Proving Logic for the Proving Algorithm
The logic relation among Lemma 1, 2, 3, 4, 5 and αβ lemma is shown in Fig. 11, which can be described as follows: We directly verify that the Proving Algorithm makes correct assertion for all multistage graphs with four stages. Then we assume that the Proving Algorithm makes correct assertion for all multistage graphs with L-1 stages. For all graphs with L stages, if the Proving Algorithm is incorrect for some multistage graphs of this kind, we can find out the ‘smallest’ one with the linear order “≤” which we defined. Therefore, without losing generality, we can further assume that G is the ‘smallest’ graph that makes the Proving Algorithm fail in determining the existence of the said simple path in step 10. Then we will get a contradiction with the smallest graph, by splitting G to get a smaller graph (Lemma 2 and 3) or compressing G to get a graph with L-1 stages (Lemma 4 and 5). To test Z-H algorithm, we need to generate instances of MSP. To generate an instance of MSP, we need to assign a set of edges to each E(v). E(v) is a subset of E, hence for all e∈E, we randomly decide whether e can be an edge in E(v) depending on the value of the current system time, i.e., e∈E(v) if and only if the value is odd. We also need a creditable algorithm to tell us if the generated instance contains a simple path. Hence our testing system has three parts: the instance generator, the backtracking algorithm as a benchmark and Z-H algorithm. Until now, since 2010.10.06, more than 52 millions of instances have been generated randomly, each of which has 100 vertices. Some instances contain a simple path while others (it is the majority in all the generated instances) do not. All the results show that our polynomial time algorithm can get the same answer as the backtracking algorithm does. No exception.
31
Reference [1] Michael R. Garey and David S. Johnson (1979), “Computer and In tractability, a Guide to the Theory of NP-completeness”, W.H.Freeman and Company [2] Xinwen Jiang (1993), “The Anti-encircling Search Strategy for Solving HC problem”, Logic and Intelligence (eds. Y.P Xu and Y.L.Su), Publising House of Electronics Industry: 116-121 [3] Xinwen Jiang (1995), “Determining the H Property of A Simple Undirected Graph”, Computer Engineering and Science 61:1-8 [4] Xinwen Jiang (1997), “A new algorithm for HC problem”, Computer Technology And Automation 16:1-4 [5] Xinwen Jiang (2004), “Determining the H Property of A Graph by Changing It into A Multistage Graph”, Computer Technology And Automation 23(2): 52-54 [6] Xinwen Jiang (2004), “Improvement for Multistage Graph Method to Determine the H Property of A Graph”, Computer Technology And Automation 23(3a):9-17 [7] Xinwen Jiang .etc (2007), “MSP: The problem, Its Algorithm and NP- Completeness”, Computer Technology And Automation 26(3a): 1-20 [8] Xinwen Jiang .etc (2009), An New Proof for Z-H Algorithm to Solve MSP Problem, Computer Technology And Automation 28(4a): 36-46 [9] Xinwen Jiang .etc (2010), The fourth version of the Proof for Z-H Algorithm to Solve MSP Problem, Computer Technology And Automation 29(3): 35-48 [10] Xinwen Jiang (2007), MSP Problem: Its NP-Completeness and its Algorithm. [Online]. Available: http:// xinwenjiang.google pages.com/ [11] Moshe Y. Vardi (2010), On P, NP, and Computational Complexity, Communications of the ACM, 53(11):5. [12] Xinwen Jiang .etc (2010), MSP Problem: Its NP-Completeness and its Algorithm, The proceedings of CUTE’ 2010.
32