On Determining the Hamiltonicity of a graph from its all

On Determining the Hamiltonicity of a graph
from its all-pair-shortest-path matrix
Shekh Ahammed Adnan Bashir
Problem Specification
Discussion of the maximum shortest path length being 4 and 5
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.
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].
For instance, we are given the all-pair-shortest-path matrix of a
graph,
When k < n/2, two cases might arise when finding the shortest path from a certain node of G, vi
to vj . To discuss this we consider two subset Vi and Vj of V, which respectively contains the
nodes adjacent to vi and vj. We further consider that, Vi and Vj are non-intersecting. Now, we
define a set Vrest = V – Vi - Vj - {vi} – {vj} . We note that, |Vrest| is less than or equal to k-2.
Because by hypothesis, |Vi| = |Vj| = k. To reach from vi to vj at least one node from Vrest must
be used.
S=
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
Case 1: There exists at least one node in Vrest adjacent to at least one of nodes from both of Vi
and Vj . At this case the maximum length of the shortest path from vi to vj is 4 .
Case 2: There does not exist at least one node in Vrest adjacent to at least one of nodes from
both of Vi and Vj . At this case all nodes in Vrest are adjacent either to nodes in Vi and Vrest or to
nodes in Vj and Vrest . Since the graph is connected, vj is reachable from vi 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
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.
1
2
3
12
11
10
4
9
5
6
8
7
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
S1 =
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].
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
We note that, in the all-pair-shortest-path matrix S1, 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-shortestpath 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
12
2
11
10
5
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 k  n / 3 , 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.
7
4
3
Figure: Graph constructed from the all-pair shortest-path-matrix S1
We note that the graph above is 2-connected. So S1 is the all-pair-shortest-path matrix of a
Hamiltonian graph.
Reference
We now look at a 6-regular, 2-connected graph with 18 nodes. Since 6 = 18 / 3, this graph is a Hamiltonian graph [1].
1
16
15
6
12
18
7
8
1. Jackson B.,
Hamiltonian cycles in
regular 2-connected
graph, Journal of
Combinatorial Theory,
Series B 29, 27-46 (1980)
11
9
4
5
13
14
17
3
9
6
Example of the maximum length of the shortest path is 5
2
8
10
Figure: 6-regular, 2-connected Hamiltonian graph with maximum length of the shortest path 5
Department of Computer Science and Engineering (CSE), BUET