3. Recognition Algorithm of Bipartite -free Graphs
The following Theorem is the key of our recognition algorithm for bipartite -free graphs.
Theorem 2.
A bipartite graph is -free if and only if every connected sub-graph of is a -graph.
Proof. Suppose that is a bipartite graph -free. Let be a connected sub-graph of which is not a -graph. By Corollary 1, contains a say . Since is a connected sub-graph of and is -free graph, there is a vertex in that connects and . Suppose without loss of generality that is a black vertex such that . Since is not -graph, the vertex is not universal, so there is a white vertex such that . Since is connected there is a path in that connects the vertex w and the path . But now the set forms a or a , a contradiction.
The inverse is clear since a or a is connected and contains a , so it is not a -graph. □
Theorem 2 states that the class of bipartite
-free graphs is the smallest class closed under parallel and
-decomposition. So the canonical decomposition tree of a bipartite
-free graph consists only of
-nodes or
-nodes. Our recognition algorithm builds a decomposition tree with
or
labeled internal nodes if the input graph is
-free otherwise a failure message.This building was influenced by the cographs recognition method proposed by Corneil, et al in [
2]. Moreover, this algorithm greatly simplifies two recognition algorithms when projected on bipartite
-free graphs. The first is for weak bisplit graphs presented in [
16] and the second for bipartite
-free graphs presented in [
12], where both these two algorithms need to examine more than twenty cases in order to confirm that the input graph is
-free or not, while, as we will see, our algorithm needs to examine only two cases that are presented below in Theorem 3 and in Theorem 4. The algorithm begins with an empty graph and gradually adds vertices, ensuring that the resulting sub-graphs remain
-free. The initial bipartite graph is considered
-free if all vertices can be added successfully in this manner. The principal step of the algorithm takes into considerationthe decomposition tree
of a
-free bipartite graph
, a vertex
, and a set of edges denoted by
, and produces the decomposition tree
of the resulting graph
if it remains
-free, or stops otherwise. The algorithm considers the connections of
to other vertices in
using a marking procedure. We can assume without loss of generality that
is a white vertex and the graph
is a bi-chromatic graph.
3.1. Marking Procedure
The Marking procedure, used in [
2], takes into consideration the neighbors of the vertex
in the graph
to mark the nodes of
, the decomposition tree of
.

At the end of the marking procedure on tree , a node can have three possible states: marked by, marked by , or marked by . If a node is marked by , it means that is total for , that is, is connected to all black vertices in . If it is marked by , it means that is partial for , that is, is connected to some but not all black vertices in . If it is marked by , it means that is independent of , that is, it is not connected to any black vertex in . If a node is a vertex node, it can either be marked by or marked by . By Theorem 2, the marking procedure focuses only on -nodes and -nodes, ignoring the -nodes that must be unavailable. For the graph to be considered bipartite-free, it must meet a necessary condition.
Lemma 1.
If two internal nodes in the tree are marked by , and is a -free bipartite graph, then one of these two nodes must be a grandparent of the other.
Proof. Suppose that and are two internal nodes marked by then and are partial with respect to . Let be the least common grandparent of and . We denote by and to be respectively the son of containing and the son of containing. Since and are sub-graphs of and then and are partial with respect to . Assume that is labeled , then and are connected sub-graphs of . Thus there is an induced path in (resp. in ) such that is adjacent to and not adjacent to (resp. to and not to ). The set forms a , a contradiction.
Assume that is labeled . By Corollary 1, (resp.) contains a that is partial with respect to . Let (resp. ) be a in (resp. in such that is adjacent to and not adjacent to (resp. to and not to ). Then the set forms a , a contradiction. □
By lemma 1, the nodes in that are marked by are arranged in a single path that starts from the lowest node marked by and goes up to the root. The lowest node marked by is referred to as . It is assumed that the conditions of Lemma 1 are met and that is known. The following notations are introduced:
Given two internal nodes and such that is a grandparent of , the unique son of that contains is denoted as .
For an internal node , which is either or one of its grandparents, the set of sons of that are marked by is denoted as , and the set of sons that are marked by is denoted as .
If has a label , considering the ordering of the sons of , the set of sons of marked by and located before is denoted as , and the set of sons marked by and located after is denoted as . The set of sons of marked by and located before is denoted as , and the set of sons marked by and located after is denoted as .
So, a node labeled which is a grandparent of splits its sons into at most three categories: , , and the son that contains,. If is labeled , its sons can be divided into at most five sets: , , , , and . Meanwhile, the sons of are split into two non-empty categories: , and .
Definition 2.
If is a grandparent of in , then is considered incompatible -node if it has at least one son marked by (i.e. . If is a -node, it is considered incompatible before if it has at least one son marked by located before (i.e. ) . If is a -node, it is considered incompatible after if it has at least one son marked by located after (i.e. ).
3.2. Building the tree
We assume that the necessary condition of Lemma 1 has been verified and all nodes that are marked by are known and are arranged in a single path that starts from the lowest marked node and goes up to the root of . In order to build , we examine the label of and the presence of incompatible marked nodes.When is -node and since it is the lowest node marked by , we can divide its group of sons into a maximum of four consecutive subsets, namely , , , where:
includes the first group of consecutive sons of that are either a group of white vertices nodes or total with respect to .
includes the first group of consecutive sons of that are not part of and either a group of white vertices nodes or not related to .
includes the first group of consecutive sons of that are not part of nor of and either a group of white vertices nodes or total with respect to .
represents the remaining sons of .
Note that, as a result of this division of the sons of when its label is , and cannot be together monochromatic graphs.
Lemma 2.
Assume that is a -node. If is a bipartite -free graph then the following conditions are hold:
-
1)
has no neighbor in .
-
2)
If is empty then is a monochromatic graph or a complete bipartite graph.
Proof. Suppose that is not empty, otherwise we are done. Let’s show that has no neighbor in . Since is not empty then and are both non empty. Let such that is adjacent to . Now, contains two adjacent vertices such that is not adjacent to otherwise . Let be two black vertices of and respectively. By construction, there is a white vertex such that is adjacent to and is not adjacent to . But now the set forms a , a contradiction.
Let’s show now that the condition 2 must be hold. Suppose that is not empty then is also non empty.
Claim 1.
Every element of is a vertex node.
Proof. Suppose that is an element of that is an internal node. Then is a -node, thus it contains a say . Let , then the set forms a , a contradiction. ■
Claim 2.
contains a white vertex.
Proof. Suppose that does not contain any white vertex then contains an element that is an internal node, a contradiction with claim 1. ■
Let be two vertices of such that . Suppose that is neither a monochromatic graph nor a complete bipartite graph. Then contains the vertices such that is adjacent to and is independent of . Consequently forms a , a contradiction.□
Theorem 3.
Assume that there is no incompatible grandparent of . is a bipartite - free graph if and only if one of either
-
1)
is a -node or
-
2)
is a -node and Lemma 2 is hold.
Proof. The if part of the Theorem has been proved in lemma 2. We will describe the building of
for the only if part. The building of
when
i s a
-node is described in
Figure 3.a. If
consists of a unique son then this son will be a son of the node labeled
. Suppose that
is a
-node. If
is empty, then we insert
in
as a new son of
. The building of
when
is a monochromatic graph or a complete bipartite graph is described also in
Figure 3b In this case, if
] is a monochromatic graph then
. □
Lemma 3.
Assume that is a bipartite -free graph. If there is an incompatible grandparent of then the following condition are holds:
-
1)
is a -incompatible node after .
-
2)
is the unique incompatible grandparent of .
-
3)
The set consists of black vertices nodes located exactly after .
Proof. Suppose that is an incompatible grandparent of of type . Then there exists two adjacent vertices in an element of . Since induces a connected graph, it contains an induced say such that is adjacent to and is independent of . But now forms a , a contradiction.
If is a -incompatible node before α, then contains a black vertex independent of . By Corollary 1, contains a say such that is adjacent to and is independent of . The set forms a , a contradiction. Consequently is a -incompatible node after . Let’s consider to be the highest incompatible grandparent of and let .
Claim.
There is no grandparent of containing a white vertex total for .
Proof. Let be a grandparent of and is a white vertex of total for . Let be an induced of such that is adjacent to and independent of . Then the set forms a , a contradiction. ■
By this claim, if is a -incompatible node after then the set consists of black vertices nodes located exactly after . Moreover, for every grandparent of labeled and located between and , is the last son of , otherwise contains a white vertex total for , a contradiction, thus cannot be incompatible. Therefore, is the unique incompatible grandparent of . □
Theorem 4.
Assume that is the unique -incompatible grandparent after and the set consists of black vertices nodes located exactly after . is a bipartite -free graph if and only if one of the following conditions is hold:
-
1)
is a -node.
-
2)
is a -node such that is an empty set.
Proof. Suppose that is a -node and let . Suppose that is non empty. By lemma 2, is a monochromatic graph or a complete bipartite graph. In the two cases cannot be a monochromatic graph otherwise is empty. Thus contains two adjacent vertices . Let be a black vertex of . Since is a connected graph then there is a white vertex say in the last son of , but now forms a , a contradiction.
For the only if part, we describe the building of
.When
is a
-node, the building of
is illustrated in
Figure 4.a. If the set
is a unique son then this son must be labeled
. In this case, we delete the node
and the element
will be a son of
. The building of
when the condition 2 is hold is illustrated in
Figure 4b If
is a unique son, then this son is either a node labeled
or a black vertex node. In this case, we delete the node
, and the element
will be a son of
.□
3.3. Recognition Algorithm
The recognition algorithm of bipartite -free graphs is given by Algorithm 2, where the procedure of the step Build-tree is presented in Algorithm 3.

3.4. Complexity
Our aim is to demonstrate that recognizing a bipartite graph , which does not contain or , can be accomplished in time complexity. Since the principal step of our algorithm is the step Build-tree, we will demonstrate the linearity of our algorithmby showing that this step requires only operations, where is the degree of the node in .
It is evident that the step 1 runs within time, as only a maximum of nodes are marked. Furthermore, we can assume that for every node in the tree , the set of its sons that are marked by , by or by has been calculated. So find the set requires also operations. Suppose that . We can check whether one of the two nodes of is a grandparent of the other as following: Choose an element of and start to mark the parent of this element, then mark the parent of parent and so on until the other element of is marked or until the root of is marked. For the last case, that is, if the root of has been marked, we repeat this process for the other element of . By this manner, we can also determine the node , the lowest node marked by and the grandparent . Obviously, this process can be done in mark operations.
It remain analysis the time complexity of the function . This requires to verify the necessary conditions in Theorem 3 or in Theorem 4. Therefore we need to compute all required sets for building the tree . If has label , then the computation of the set and the set is straightforward. Suppose has label . We can compute the sets , , ,and as following: First, we compute by traversing the set of sons of from left to right. In this manner, will be the first nodes that are either a set of white vertices or nodes marked by , we continue by this traversing until a son of marked by has been found. The remaining sons of marked by must belong to since is independent of according to Lemma 2. To compute , we choose a son of (let’s call it ) from the remaining nodes marked by and we traverse the set of sons of starting from in left and right directions, from left until a son of marked by has been found and from right also until a son of marked by has been found or until the last son from right has been found. We continue by this traversing as long as every son is either a white vertex node or is a node marked by . As long as the set has been computed, the sets can be computed immediately. The remaining sons of form the set which must be independent of This computation requires time complexity.
Finally, we need to determine if the node , which its label is , is incompatible after or not and check whether the set is a set of black vertices nodes located exactly after . This two conditions can be achieved together as following: Since is known as a grandparent of , the son is identified. Now, we can traverse the sons of starting from the first son located exactly after and determine whether any one of these sons is a white vertex node or not. In addition, we must traverse the sons of starting from the first son located exactly before to determine if the set is empty or not. This traverse also requires time complexity.
we leave to the reader to verify that the step Build-tree that correspond to insert in the tree takes a constant time in all cases.
Since testing whether is a bipartite -free or not can be done within time complexity, it is clear that recognition of bipartite -free graph algorithm runs in time complexity.