# Efficient Algorithm to Determine Whether a given Graph is Hamiltonian or not with all Possible Paths Narendra Pratap Singh ? , Ramu Agrawal ? & Indra Paliwal ? Abstract -Given a Graph G (V, E), We Consider the problem of deciding whether G is Hamiltonian, that is-whether or Not there is a simple cycle in E spanning all vertices in V. [1] However to Verify that the given cycle is Hamiltonian by checking whether it is permutation of the vertices of V and whether each of the consecutives edges along the cycle actually exists in the Graph. This Verification Algorithm can certainly be implemented to run in O (n 2 ) time, where n is the length of the encoding of G [2]. But to predict in Advance that the Graph has Hamiltonian Cycle or not was still Exponential before this Algorithm. This Problem is known to be NP-Complete hence cannot be solved in Polynomial time in |V| unless P=NP. However till today there was no known Criterion we can apply to determine the existence Hamiltonian Circuit in General [3] # Introduction amiltonian Problem is Decision Problem in which G (V, E) should be traversed from any one vertex to same vertex without repeating any vertex again (means, Vertex should be traverse exactly once). We look for n long sequence of vertices v 0 , v 1 , v 2 , .?., v n-1 visit all vertices in v such that n i ? ? 0 , (vi, v(i+1)mod n) E ? , along with the element of Adjacency Matrix Ai, j= 1,if ) , ( j i E ? ? , 0, otherwise. From the general prediction as prescribed in literature that Hamiltonian Cycle exists if and only if there is an nlong Author ? ? ? : Department of Computer Science, BSA College of Engineering and Technology, Mathura, U.P, India. E-mail ? : narendrapratapbsa@gmail.com E-mail ? : ramuagrawalbsa@gmail.com E-mail ? : indrapaliwal@gmail.com tour that cover all the vertices and returns to the standing point. Scientist around the globe deduced the Method based on the number of edges and degrees of graph, some for planarity and some for connected but they all failed for a general graph and was not sufficient. It follows the CNF-satisfiability also [4]. But we put through the above statement from the mathematical and logical point of view. By this algorithm, now the scientist will have reasonable condition to determine the Hamiltonian Circuit in Advance without traversing it vertex to vertex manually on the paper. Till today this problem which spurred the computer scientist around the globe to be able to draw an Algorithm which Culminate the possibilities, the usage of global information was shown to speed up the process: however it has cost in communication and complexity of individual agent. Now in our Algorithm there is no foundation for an undirected, directed, planarity, colorability, and connectedness of a graph, it can be applied to the all types of graphs. Rest of the paper is organized as follows. Section2 present the related work. The proposed method algorithm has been described in section3. In section4, experimental results and sample run have been presented and paper is concluded in section5. # II. # Related work Since, its (Hamiltonian Cycle Problem) origin, by famous Irish Mathematician Sir William Rowan Hamilton, 1859, was still unsolved. There was no known criterion we could apply to determine the existence of Hamiltonian circuit in general. A circuit is a connected graph G is said to be Hamiltonian if it includes every vertex of G. Hence a Hamiltonian Circuit in a Graph of n vertices cost of exactly n edges. Obviously, not every connected Graph has Hamiltonian Circuit. For example, neither of the Graph shown in figures (2.1 and 2.2) and has a Hamiltonian circuit. This raise the Question: What is the necessary and sufficient condition for a connected Graph G to have Hamiltonian Circuit? [5] Also, No known Characterization to determine Hamiltonian graph in any given Graph G has been found [6]. ( D D D D ) C 2012 # Year However several Scientist has proposed several methods on the basis of degree and edges with the reference to any specific graph (like connected, planarity, etc.). But they had not found full success with necessary condition to predict Hamiltonian cycle in advance for every Graph. Most of works has been presented before the 1975. Hence there was no programming based algorithmic approach had been considered? Some famous works are as follows: ? Every Graph G with 3 ? n vertices and minimum degree at least n\2 has a Hamiltonian Cycle [7] (Dirac 1956). [Note that this theorem bound prediction within limit of The following theorem characterizes all Hamiltonian Sequences. 3 ? n .] ? Every Graph G with |G| 3 ? and K(G) ? ?(G) ? (Chvatal 1972), An integer Sequence (a 1 , ?., a n ) such that 0? a 1 ???? a n