Presentation is loading. Please wait.

Presentation is loading. Please wait.

On Determining the Hamiltonicity of a graph from its all-pair-shortest-path matrix Shekh Ahammed Adnan Bashir Department of Computer Science and Engineering.

Similar presentations


Presentation on theme: "On Determining the Hamiltonicity of a graph from its all-pair-shortest-path matrix Shekh Ahammed Adnan Bashir Department of Computer Science and Engineering."— Presentation transcript:

1 On Determining the Hamiltonicity of a graph from its all-pair-shortest-path matrix Shekh Ahammed Adnan Bashir Department of Computer Science and Engineering (CSE), BUET Problem Specification We are given the all-pair-shortest-path matrix of a graph. We have to determine whether the graph is Hamiltonian or not without constructing the graph. For instance, we are given the all-pair-shortest-path matrix of a graph, 0 1 2 2 2 2 3 2 2 1 1 1 1 0 1 1 2 1 2 2 3 2 2 2 2 1 0 1 2 1 2 2 3 2 1 2 2 1 1 0 1 2 2 3 2 1 2 2 2 2 2 1 0 2 1 2 1 2 1 2 2 1 1 2 2 0 1 1 2 3 2 2 3 2 2 2 1 1 0 1 1 2 2 2 2 2 2 3 2 1 1 0 1 2 2 1 2 3 3 2 1 2 1 1 0 1 2 2 1 2 2 1 2 3 2 2 1 0 2 1 1 2 1 2 1 2 2 2 2 2 0 1 1 2 2 2 2 2 2 1 2 1 1 0 S = By observing the number of 1’s and maximum entries of each row of S, we can assume that this is the all-pair-shortest-path matrix of a Hamiltonian graph. Then we can construct the graph and if the graph is 2-connected or not. If it is 2-connected, then the graph is Hamiltonian one. 123456 78910 1112 Figure: Graph of the all-pair-shortest-path matrix S. A Hamiltonian cycle in this graph is 1-2-3-4-5-7-6-8-9-10-12-11-1 Approach We have studied the structure of some known Hamiltonian graphs. We tried to find all the possible entries in the all-pair-shortest-path matrix of those Hamiltonian graph. We have yet been successful to find all possible entries in the all-pair-shortest-path matrix in the graphs proved to be Hamiltonian by Jackson [1]. Result We have found that the all-pair-shortest-path matrix of a graph proved to be Hamiltonian by Jackson [1], contains exactly k number of 1’s in each row, diagonal elements are 0, rest of the entries of each row do not exceed 5 and, n is the number of nodes So for if it is given only the all-pair-shortest-path matrix of a graph and it has one 0 in each row as diagonal element, exactly k number of 1’s in each row, and rest of the entries of the graph do not exceed 5 then we can assume the graph to be Hamiltonian. To be sure we construct the graph and check if the graph is 2-connected or not. We look at two examples. In the first example, we are given the all-pair-shortest-path matrix of a graph. In that matrix, the maximum entry in any row is 4. In the second example, we are given the all-pair-shortest-path matrix of a graph with no entry greater than 5 in any row. 0 1 1 1 2 2 2 3 3 3 2 1 1 0 1 1 1 2 3 4 3 4 3 2 1 1 0 1 1 2 3 4 3 4 3 2 1 1 1 0 1 2 3 4 3 4 3 2 2 1 1 1 0 1 2 3 2 3 3 2 2 2 2 2 1 0 1 2 1 2 2 1 2 3 3 3 2 1 0 1 2 1 2 1 3 4 4 4 3 2 1 0 1 1 1 2 3 3 3 3 2 1 2 1 0 1 1 2 3 4 4 4 3 2 1 1 1 0 1 2 2 3 3 3 3 2 2 1 1 1 0 1 1 2 2 2 2 1 1 2 2 2 1 0 S 1 = We note that, in the all-pair-shortest-path matrix S 1, there are only one 0 as diagonal elements, exactly 4 1’s in each row, and no entry in any row exceeds 4, and this is the all-pair-shortest- path matrix of a graph on 12 nodes and 4 = 12 / 3. So by our result, we can assume that this is the all-pair-shortest-path matrix of a Hamiltonian graph if it is of a 2-connected graph. Now to find whether the graph is 2-connected or not we construct the graph. If we find the graph to be 2-connected, then the graph is Hamiltonian. 1 4 3 52 7 6 12 8 9 1110 Figure: Graph constructed from the all-pair shortest-path-matrix S 1 We note that the graph above is 2-connected. So S 1 is the all-pair-shortest-path matrix of a Hamiltonian graph. We consider that, G = (V, E) is a k-regular, 2-connected graph where, |V| = n and k is greater that of equal to n/3. Such a graph is Hamiltonian graph [1]. When k < n/2, two cases might arise when finding the shortest path from a certain node of G, v i to v j. To discuss this we consider two subset V i and V j of V, which respectively contains the nodes adjacent to v i and v j. We further consider that, V i and V j are non-intersecting. Now, we define a set V rest = V – V i - V j - {v i } – {v j }. We note that, |V rest | is less than or equal to k-2. Because by hypothesis, |V i | = |V j | = k. To reach from v i to v j at least one node from V rest must be used. Case 1: There exists at least one node in V rest adjacent to at least one of nodes from both of V i and V j. At this case the maximum length of the shortest path from v i to v j is 4. Case 2: There does not exist at least one node in V rest adjacent to at least one of nodes from both of V i and V j. At this case all nodes in V rest are adjacent either to nodes in V i and V rest or to nodes in V j and V rest. Since the graph is connected, v j is reachable from v i and hence in this case the maximum length of the shortest path is 5. Example of the maximum length of the shortest path is 4 Example of the maximum length of the shortest path is 5 We now look at a 6-regular, 2-connected graph with 18 nodes. Since 6 = 18 / 3, this graph is a Hamiltonian graph [1]. 3 6 1 5 4 2 17 8 7 1615 10 9 11 12 13 14 18 Reference 1. Jackson B., Hamiltonian cycles in regular 2-connected graph, Journal of Combinatorial Theory, Series B 29, 27-46 (1980) Discussion of the maximum shortest path length being 4 and 5 Figure: 6-regular, 2-connected Hamiltonian graph with maximum length of the shortest path 5


Download ppt "On Determining the Hamiltonicity of a graph from its all-pair-shortest-path matrix Shekh Ahammed Adnan Bashir Department of Computer Science and Engineering."

Similar presentations


Ads by Google