Classical problems such as HAMILTONIAN PATH (CYCLE), LONGEST PATH have applications in the field of mathematics and computing, for example, . Given a connected graph , the Hamiltonian path (cycle) problem asks for a simple spanning path (cycle) in .
While there has been a constant study on the structural front to obtain a necessary and sufficient condition for the existence of a Hamiltonian path (cycle), on the complexity front, it is known that these problems are NP-complete . We do not know of any necessary and sufficient condition for the existence of a Hamiltonian path (cycle) in general graphs, however, we know of necessary conditions, and sufficient conditions .
To understand the complexity of NP-complete problems, it is natural to either restrict the input based on some structural observations or to focus on special graphs. Focusing on special graphs such as chordal graphs, chordal bipartite graphs, etc., is a promising direction as problems such as VERTEX COVER, CLIQUE, COLORING have polynomial-time algorithms on chordal and chordal bipartite graphs. As far as the Hamiltonian path and cycle problems are concerned, both structural and algorithmic study even in popular special graphs is considered to be a challenging task. This is due to, (i) there are no necessary and sufficient conditions for the existence of Hamiltonian path in special graphs such as chordal and chordal bipartite which are the most sought after graph classes in the literature, (ii) these problems are NP-complete even in chordal and chordal bipartite graphs .
When a problem is NP-complete in chordal bipartite graphs, it is natural to restrict the input further and study the complexity status on convex bipartite graphs which are a well-known subclass of chordal bipartite graphs. Due to the convexity property, it is easy to see that any cycle of length at least 6 has a chord in it and hence, convex bipartite graphs are a subclass of chordal bipartite graphs. Similarly, interval graphs which are a subclass of chordal graphs is a candidate graph class for problems that are NP-complete in chordal graphs. For example, HAMILTONIAN CYCLE and VERTEX COVER are polynomial-time solvable in the interval and convex bipartite graphs. Interestingly, convex bipartite graphs and interval graphs have a structural relationship and hence there is a polynomial-time reduction that converts an instance of interval graph to an instance of convex bipartite graph, and vice-versa. Further, for many problems, algorithms designed for interval graphs can be used to solve problems in convex bipartite graphs. One such problem is HAMILTONIAN CYCLE whose solution in convex bipartite graphs can be obtained from interval graphs . The algorithm presented in  requires effort to output a Hamiltonian cycle in a convex bipartite graph if exists.
The study of Hamiltonicity includes HAMILTONIAN CYCLE and HAMILTONIAN PATH. HAMILTONIAN CYCLE is polynomial-time solvable in convex bipartite graphs [4, 6] whereas, to the best of our knowledge, the complexity of HAMILTONIAN PATH is open. The objective of this paper is two-fold; (a) we present a characterization for HAMILTONIAN CYCLE as there are no known structural characterizations for the existence of Hamiltonian cycles in convex bipartite graphs. Further, we present a linear-time algorithm for this problem. (b) we also present a linear-time algorithm for Hamiltonian path problem in monotone convex bipartite graphs. We believe that the results presented can be extended for further research to study the complexity of HAMILTONIAN PATH in non-monotone convex bipartite graphs and LONGEST PATH and MIN-LEAF SPANNING TREE in convex bipartite graphs. We wish to highlight that the algorithms appeared in  for longest path problems in biconvex and convex graphs (convex bipartite graphs) have an error and it does not compute an optimum solution always. We present an infinite set of counterexamples in support of our claim. All of our counterexamples are non-monotone convex bipartite graphs and for monotone convex bipartite graphs, the algorithm presented in  gives a Hamiltonian path by incurring effort, while our algorithm is linear.
Roadmap: We next present preliminaries required to present our results. We shall present results on HAMILTONIAN CYCLE in Section 3. In Section 4, we shall present our results on HAMILTONIAN PATH. Results on non-monotone convex bipartite graphs are presented in Section 5.
2 Graph Preliminaries
All graphs used in this paper are simple, connected and unweighted and we follow the standard definitions and notation . For a graph , denote the vertex set by and the edge set by is adjacent to in . The neighborhood of a vertex in is . The degree of a vertex in is . We denote . A vertex is said to be pendant if .
A bipartite graph with partitions and is a convex bipartite graph if there is an ordering of such that for all , is consecutive with respect to the ordering of , and is said to have convexity with respect to . Let and . Define the set to be , the set and the set and . For a vertex with , we define and . The set is said to be maximal if and there is no such that , or , and we refer to this set as maximal. Similarly, the set is said to be minimal if and there is no such that , or , and we refer to this set as minimal. Throughout out this paper, denotes a convex bipartite graph with convexity on .
3 Hamiltonian cycles in convex bipartite graphs
In this section, we shall present a characterization for the existence of Hamiltonian cycles in convex bipartite graphs. We shall define a property, namely Property A in convex bipartite graphs. Further, we present a transformation to transform an input convex bipartite graph into an interval graph. Subsequently, we show that Hamiltonian cycles in convex bipartite graphs exist if and only if Hamiltonian cycles in the interval graphs exist. Our structural results are new and a part of algorithmic results make use of the results presented in [4, 6]. Towards the end, we shall visit the Hamiltonian path problem and present a solution for monotone convex bipartite graphs.
Let be a convex bipartite graph. is said to satisfy Property A, if it satisfies the following properties,
For any set ,
For any integer ,
Transformation: Convex bipartite graphs to Interval graphs
Let be a convex bipartite graph with . We shall now define the corresponding interval graph as follows; and , where and . Interestingly, Muller  has related the Hamiltonian cycles in interval graphs and convex bipartite graphs and his result is given below.
 Let be a convex bipartite graph with and be the corresponding interval graph of . has a Hamiltonian cycle iff has a Hamiltonian cycle.
It is a well-known result  that the maximal cliques of an interval graph can be linearly ordered, such that, for every vertex of , the maximal cliques containing occurs consecutively in the ordering. To present our results on HAMILTONIAN CYCLE in the corresponding interval graphs, we shall reuse the definitions and notation given in  by Keil.
A maximal clique in corresponds to a set of mutually overlapping intervals in . Every clique in has a representative point which is contained in exactly those intervals corresponding to vertices in . That the cliques of can be linearly ordered by their representative points follows from the following lemma from Gilmore and Hoffman .
 The maximal cliques of an interval graph can be linearly ordered, such that, for every vertex of , the maximal cliques containing occurs consecutively.
We call a clique of , , when its representative point is the smallest of the representative points of the cliques of . A vertex that appears in a clique is called a conductor for if also appears in . Let be the set of the first cliques of . A path in is spanning for if contains all vertices of that appear only in and has two conductors of as endpoints. Let be the set of representative points of the cliques containing vertex . A point embedding of a path , with vertices, is an assignment of a point from to such that for . A path is straight if it has a point embedding with the property that for . In a straight path with point embedding , is the active conductor between and , and is the active conductor between the smallest point in and . A path , with endpoints and , that spans is said to be U-shaped if there exists a vertex in that appears only in such that the subpaths of from to and from to are both straight. Such a vertex is called the base of the U-shaped path . The below characterization due to Keil  is an important result and our result is based on this key result.
 Let be an interval graph with maximal cliques. has a Hamiltonian cycle iff there exists a U-shaped spanning path for , .
The interval graph that we will be working with is not an arbitrary interval graph, instead, it is the graph obtained from a convex bipartite graph through the above transformation. We shall now present a series of structural results using which we establish that the transformed interval graph has indeed a U-shaped spanning path. As a consequence, we obtain a Hamiltonian cycle in the interval graph. Throughout this section, we work with a convex bipartite graph with partitions and and be the corresponding interval graph of .
Let be a convex bipartite graph and be the corresponding interval graph of . Then, the number of maximal cliques in is .
By our construction, for each , induces a clique in . Further, is also a clique in . Again, by the construction of , no two elements of are adjacent in . Thus, is a maximal clique in . Therefore, the number of maximal cliques in is . ∎
Each clique of contains exactly one vertex such that, is the vertex in the convex ordering on .
Follows from Lemma 3. ∎
Let be a convex bipartite graph and be the corresponding interval graph of . Then, , where denotes the vertex set of .
From Lemma 3, we know that each appears in some maximal clique in . Further, each is adjacent to some and therefore and together appear in some maximal clique in . Thus, follows. ∎
Let be a convex bipartite graph. If satisfies Property A, then and , .
By the definition of Property A, . Observe that , where and , and and . Note that by the definition, and . Similarly, and . This implies that . Therefore, . Further, . Hence, the claim follows. ∎
Let be a convex bipartite graph. If satisfies Property A, then , appears in at least two consecutive maximal cliques of .
Given a convex bipartite graph satisfying Property A, we shall next present an algorithm (Algorithm 1) which outputs a Hamiltonian cycle. Later, we show that convex bipartite graphs satisfying Property A always possess Hamiltonian cycles. Our algorithm is a modified version of the algorithm presented in  in the context of interval graphs obtained through the above transformation.
Proof of correctness of Algorithm 1: As part of correctness, we need to show that our algorithm always outputs a Hamiltonian cycle. We first show that at each iteration, our algorithm has two conductors through which extension of the path between iterations is guaranteed. Secondly, we show that at each iteration, we include exactly one and one in the path.
Let be a convex bipartite graph satisfying Property A and be the corresponding interval graph of . Algorithm 1 always outputs a Hamiltonian cycle in .
The correctness of the algorithm follows from the following claims.
For every iteration , , the spanning path obtained from the algorithm has two conductors labeled with and as endpoints.
The proof is by contradiction. Since is connected, we find at least one conductor between any two adjacent cliques. Let be the least index such that has exactly one conductor. This implies that has two conductors labeled with and as endpoints. At iteration , without loss of generality, assume that the extension of the path is from and is relabeled . The label of is unchanged and is still the conductor. Suppose, between and , we do not find a conductor to be labeled . That is, has exactly one conductor labeled . Note that until , the vertices are included in the path. Further, can be reached from of . However, a further extension to reach is not possible as we have exactly one conductor, i.e., there is no and is an unlabeled conductor which is adjacent to both and . Due to the above structural observation, we observe that and this implies that , contradicting the upper bound of Property A. Therefore, we get two conductors between iterations. ∎
In what follows from the above claim is that we obtain a -shaped path in with as the base vertex. Further, using , we obtain a Hamiltonian cycle in . We observe a stronger result that the Hamiltonian cycle alternates between the vertices of and which we shall present next.
Let = is labeled as in the spanning path . The spanning path , is such that = .
The proof is by contradiction. Case 1: . Note that which contradicts the lower bound of Property A. Case 2: . Observe that there exists an iteration in which at least two vertices of are labeled and choose the least to work with. Thus we get, and , which contradicts the upper bound of Property A. ∎
The above two claims ensure that the path constructed alternates between a vertex of and and using we obtain a Hamiltonian cycle in . ∎
Let be a convex bipartite graph satisfying Property A. always has a Hamiltonian cycle.
We first obtain the corresponding interval graph of using the transformation explained in this section. From Theorem 3.2, we know that has a Hamiltonian cycle. From the construction of Hamiltonian cycle in , it is clear that the cycle does not contain edges such that . Thus, is also a Hamiltonian cycle in . ∎
Run-time Analysis: Given a convex bipartite graph satisfying Property A, if , then . Thus, the transformed interval graph is such that and . We shall now analyze the complexity of Algorithm 1. It is known from Booth and leuker  that maximal clique ordering (MCO) of interval graphs can be obtained in . Using MCO, the height and level information can be obtained in time. Steps 4-12 of the algorithm essentially identifies the appropriate that can connect two consecutive vertices. For a vertex , among unlabeled vertices, the vertex whose degree is minimum is chosen. Since the cost of this task is at most the degree of and the sum of the degrees is , the overall time complexity is which is linear in the input size.
Let be a convex bipartite graph satisfying Property A. The Hamiltonian cycle in can be found in linear time.
Follows from Theorem 3.3 and the above discussion. ∎
We next present a necessary and sufficient condition for to have a Hamiltonian cycle, an important contribution of this section.
Let be a convex bipartite graph. has a Hamiltonian cycle iff satisfies Property A.
Necessary: Suppose, has a Hamiltonian cycle and does not satisfy Property A.
Case 1: There exists a set , such that , or or . Then, Case 1.1: contains the set in order, and the set , alternately. Then, includes at most vertices that belong to . Therefore, no Hamiltonian cycle exists in . Case 1.2: contains the set out of order, and , alternately. Then, includes at most vertices that belong to . Therefore, is not a Hamiltonian cycle.
Case 2: There exists number of sets , where such that
Let the set and where . We observe that containing all the vertices in the set can include at most vertices from the set . However, , a contradiction.
Case 3: . We observe that , where and , and and . Since for a Hamiltonian cycle to exists, the graph must be 2-connected. This implies . Thus, . For bipartite graphs to have a Hamiltonian cycle, . This implies cannot exist with more than or less than vertices of .
Case 4: . Clearly, no Hamiltonian cycle exists with less than or more than vertices from since by definition, , where and . Since we arrive at a contradiction in all cases, the necessary condition follows.
Sufficiency: Sufficiency follows from Theorem 3.3. ∎
Computation of height and level information. For the illustration, . Note that the height of is . Level information is as follows; .
At iteration 1, i.e., , the vertex is the base of the -shaped path and the endpoints are and . Label as and as . Further, the vertex is labeled . The path constructed is .
; Using and labels and , we shall now extend the path. Since or and and , we find . This means, we extend by adding a vertex and a vertex. Since the unlabeled conductor of is , we obtain . Label as and label and 2 as
; Since , extend the path from . We obtain . Label and as and as .
; Since , extend the path from . We obtain . Label and 4 as and as
; Since and , find . Choose either or to extend the path to get . Label and 5 as and label as .
; join to complete the cycle.
We next present an important result which says that Chvatal’s necessary condition is indeed sufficient for 2-connected convex bipartite graphs.
Let be a 2-connected convex bipartite graph. has a Hamiltonian cycle if and only if for every , , where denotes the number of connected components in .
We shall prove the sufficiency as the proof of necessary part follows from Chvatal’s result. The proof is by contradiction. If, on the contrary, assume that does not have a Hamiltonian cycle. By Theorem 3.5, does not satisfy Property A. The following case by case analysis completes the proof.
Case 1: violates the upper bound of Property A. This implies that there exists a set for which , where or or . If we consider , then , contradiction to the premise that .
Case 2: violates the lower bound of Property A. There exists number of sets , where such that
Then, . A contradiction to the premise.
Case 3: By definition, it is clear that for , . Note that if , then there exists a pendant vertex in , however, we know that is 2-connected. Therefore, .
Case 3a: . Then, .
Case 3b: . Then, .
Since, we arrive at a contradiction in all of the above, our assumption that has no Hamiltonian cycle is false. ∎
Remark: If the above theorem is used for the algorithmic purpose, then test for Hamiltonicity requires exponential time in the input size.
4 Hamiltonian paths in convex bipartite graphs
In this section, we shall present some structural results and a polynomial-time algorithm to find Hamiltonian paths in monotone convex bipartite graphs.
Let be a convex bipartite graph. is said to satisfy Property B if it satisfies the following properties
For any set ,
For any integer ,
The number of pendants is at most 2 and for , there is no having two pendant vertices incident on it.
To present algorithmic results, we partition convex bipartite graphs satisfying Property B into two sets, namely monotone and non-monotone, and their definitions are as follows;
Let be a convex bipartite graph satisfying Property B. is monotone if it satisfies the following properties;
There does not exist a pendant vertex such that is adjacent to , .
There does not exist a maximal , .
Let be a convex bipartite graph satisfying Property B. is non-monotone if it satisfies at least one of the following properties;
There exists a pendant vertex such that is adjacent to , .
There exists a maximal , .
We next consider the Hamiltonian path problem and show that convex bipartite graphs with Hamiltonian paths satisfy Property B.
Let be a convex bipartite graph. If has a Hamiltonian path then satisfies Property B.
For a contradiction, assume that has a Hamiltonian path and does not satisfy Property B.
Case 1: There exists such that , or or . Then,
Case 1.1: contains vertices from and neither nor as endpoints as well as penultimate vertices. Consider which is a permutation of , and is such that contains this permutation as an ordered subset. That is, the vertices in the chosen permutation appears in order in . It is clear that contains vertices from and alternately. Therefore, has at most vertices from (). This implies that is not a Hamiltonian path, a contradiction.
Case 1.2: Same as Case 1.1 except that either or as endpoints or penultimate vertices in . In this case, includes at most vertices that belong to and hence is not a Hamiltonian path.
Case 1.3: In this case, the vertices in the permutation are visited out of order. That is, is such that appears in the subpath containing . If suppose, neither nor as endpoints as well as penultimate vertices, then includes at most vertices of . On the other hand, or or both can appear as endpoints or penultimate vertices in , and . Accordingly, we see that includes at most or vertices that belong to and hence is not a Hamiltonian path.
Case 2: There exists such that , and . Since any path in alternates between and vertices, any Hamiltonian path contains at most vertices from , a contradiction.
Case 3: There exists number of sets , where such that
Let the set and where . We observe that any path containing all the vertices in the set can include at most vertices that belong to the set . Moreover, . Therefore, does not have a Hamiltonian path.
Case 4: The number of pendants is at least 3. Clearly, no Hamiltonian path can have all three pendant vertices.
Thus, our claim that convex bipartite graphs with Hamiltonian paths satisfy Property B is true. ∎
We shall next focus on monotone convex bipartite graphs and present a linear-time algorithm (Algorithm 2) for HAMILTONIAN PATH.
4.1 Proof of correctness of Algorithm 2
Let be a monotone convex bipartite graph. Consider the graph induced on , where such that is maximum and is a pendant adjacent to if exists. (or)
, where such that is maximum.
Then is monotone.
We first show that satisfies Property B. To prove the upper bound, we consider the following cases; for any integer and such that
. Then, .
and . Case: does not exist. Suppose . Observe that . This implies that which is the desired upper bound of Property B in . Otherwise, . Then is adjacent to . In this case, . Thus satisfies the upper bound. Case: exists. Suppose . Observe that