Efficient Algorithm for Checking 2-Chordal (Doubly Chordal) Bipartite Graphs
Abstract
We present an algorithm for determining whether a bipartite graph is 2-chordal (formerly doubly chordal bipartite). At its core this algorithm is an extension of the existing efficient algorithm for determining whether a graph is chordal bipartite. We then introduce the notion of -chordal bipartite graphs and show by inductive means that a slight modification of our algorithm is sufficient to detect this property. We show that there are no nontrivial -chordal bipartite graphs for and that both the -chordal bipartite and -chordal bipartite problem are contained within complexity class .
keywords:
doubly chordal , 2-chordal1 Introduction
The study of chordal graphs can be traced back to 1958 when they were first introduced by Hajnal and Surányi. These are the graphs for which every cycle of length four or greater contains a chord [1]. Since then several subclasses and variations of chordal graphs, notably bipartite analogs, have been introduced. Of interest to us is the notion of a 2-chordal bipartite (also known as a doubly chordal bipartite) graph which was recently connected to discrete statistical models and their maximum likelyhood degrees [2]. Efficient algorithm for recognizing chordal graphs and chordal bipartite graphs are known and are of polynomial complexity on the size of the vertex set[3] [4] [5]. 2-chordal bipartite graphs can be characterized as those bipartite graphs which are chordal bipartite and lack a double-square graphs as an induced subgraph, however the induced subgraph problem is known to be NP-complete in general [2] [6].
In this work, we present an efficient algorithm for checking whether a graph is 2-chordal bipartite and as a corollary show that the induced subgraph problem for the double-square graph is solvable in polynomial time. The algorithm breaks into two components- the first being the check that the graph is chordal bipartite and the second being an iterative process which runs over all edge deletions and is based on the vertex characterization due to Farber. We also show that the conditions checked are both necessary and sufficient conditions (although there may be a faster check for them) and then characterize the runtime of the algorithm. The key theorem underlying this algorithm is Theorem 3.1.
Theorem 3.1 (2-Chordal Bipartite Identification Theorem).
Given a bipartite graph , it is 2-chordal bipartite if and only if both of the following are true:
-
(i)
is chordal bipartite.
-
(ii)
for each , the graph obtained from by deleting edge is chordal bipartite.
We also introduce and explore the natural generalization of Theorem 3.1 to -chordal bipartite graphs. This generalization allows us to propose algorithms which check the property of being -chordal bipartite and we show that they are also in complexity class for all . However, we provide a proof that there are no nontrivial -chordal bipartite graphs for where nontrivial means that they contain a cycle of size at least and in doing so remove the need for anything other than the algorithms.
2 Background
In this section we lay out a few foundational results about chordal and strongly chordal graphs as well as their connection to chordal bipartite graphs. Formally, a chordal graph is a simple graph possessing no chordless cycles of length four or greater. Such a cycle is called a hole and so a chordal graph is a graph without holes [1]. A subclass of these graphs, introduced by Farber, is the strongly chordal graphs; these are chordal graphs for which every even cycle of length at least 6 has a strong chord, i.e. a chord joining vertices whose distance along the cycle is odd [3]. As we will see, strongly chordal graphs are closely related to another subclass found among bipartite graphs.
We will put a name to two special types of vertices: simplicial vertices and simple vertices. A simplicial vertex is a vertex whose open neighborhood forms a clique; that is, a vertex in the graph is simplicial if the subgraph induced on is a complete graph. Meanwhile, a simple vertex is a vertex whose neighbors have closed neighborhoods which can be ordered as a chain under inclusion; that is, a vertex in the graph with open neighborhood is simple if there exists some relabeling on such that
Observe that every simple vertex is also simplicial. The proof is as follows, suppose is a simple vertex and consider the induced subgraph on . It suffices to show that for any pair of edges there is an edge between them. As the set of closed neighbhorhoods of neighbors of form a chain, we have either or . In either case, as desired.
These distinguished vertex classes play an important role in the theory of chordal graphs. A graph is chordal if and only if every induced subgraph contains a simplicial vertex and a graph is strongly chordal if and only if every induced subgraph has a simple vertex [3] [4]. These properties lend themselves to finding chordal and strongly chordal graphs by means of algorithms which perform a simplicial elimination ordering or a simple elimination ordering respectively; that is, an algorithm to determine whether a graph is chordal (strongly chordal) is to search the graph for a simplicial (simple) vertex, form the subgraph induced by removing it, and repeat. Such an algorithm effectively checks either that there are sufficiently many simplicial vertices- i.e. every induced subgraph contains at least one of them- or it identifies a particular induced subgraph which does not contain a simplicial vertex. Note that the algorithm does not run over all induced subgraphs nor is it a requirement to do so.
These algorithms provide polynomial-time methods of determining characteristics of graphs. For strong chordal graphs, the simple elimination ordering is equivalent to the strong elimination ordering which is an ordering of the vertices such that if (i) and , (ii) , (iii) , then [5]. There are numerous other characterizations of strongly chordal graphs which include sun-characterizations, hereditary dually chordal characterizations, hypertree characterizations, and -vertex cycle subgraph characterizations [7]. One characterization that we will briefly touch on is the hypergraph characterization. A graph is chordal if and only if the hypergraph of its maximal cliques is the dual of a hypertree. This leads us to the definition of a dually chordal graph, which is a graph whose hypergraph of maximal cliques is itself a hyperrtree. A graph is called doubly chordal if it is both chordal and dually chordal. This naming convention will influence our choice of nomenclature when it comes to bipartite graphs.
We now turn our attention to bipartite graphs proper and their subclasses. A bipartite graph is chordal bipartite if every cycle of length greater than or equal to 6 has a chord. A bipartite graph is 2-chordal bipartite if every cycle of length greater than or equal to 6 has at least two chords. This property has also been called “doubly chordal bipartite” in the literature, but due to the classical definition of doubly chordal mentioned above we have adopted “2-chordal bipartite” in its place [2]. If is a bipartite graph and is the graph obtained from by adding an edge in-between every pair of vertices in , then is chordal bipartite if is strongly chordal [7]. This provides a link between our concepts. An important observation is that a chordal bipartite graph need not be chordal. For example, consider the graph with and . Clearly this graph is vacuously chordal bipartite as it contains no cycles of length 6. However, it contains the cycle , of length 4, and this cycle contains no chords (in fact, it uses every edge of as highlighted by the addition).
3 Algorithm for determining whether a graph is 2-chordal bipartite
We begin with our main algorithm which takes a bipartite graph as input and answers the yes/no question of whether or not the graph is 2-chordal bipartite. We define two classes beforehand. The first is the class graph which is initialized with a triple containing its name, vertex set, and edge set given as pairs of vertices. For its methods it has the usual graph operations as well as a method called simple which takes as input a vertex and outputs a boolean value representing whether or not the vertex is simple. The second class is biGraph which is initialized with a 4-tuple containing its name, two disjoint vertex sets, and its edge set given as pairs selected from both sets. Its methods are the usual operations on bipartite graphs as well as a forgetful operation which constructs its underlying graph. With this in mind we are ready to present the algorithm.
A fast implementation of the simple method for vertices can be done in any software which can check whether a collection of sets is nested. Having introduced the algorithm we will now show that it successfully detects whether or not the graph is 2-chordal bipartite. We claim that the graph successfully checks (i) and (ii) of Theorem 3.1.
Theorem 3.1 (2-Chordal Bipartite Identification Theorem).
Given a bipartite graph , it is 2-chordal bipartite if and only if both of the following are true:
-
(i)
is chordal bipartite.
-
(ii)
for each , the graph is chordal bipartite.
We first look at the intuition behind this theorem. Property (ii) is not sufficient alone as we could have a graph which was entirely a cycle of size 6. In this hypothetical graph , the modified graph would satisfy (ii) for any as it contains no cycles. However, the original graph clearly fails to be chordal bipartite let alone 2-chordal bipartite. With the addition of (i), we guarantee that any cycle of size 6 or more contains at least one chord. As we iterate over the edges of the graph in (ii), we encounter this chord and our modified graph contains the same cycle, but with one fewer chords. Therefore if the modified graph is chordal bipartite, it must contain a second chord.
Proof.
Let be a graph. Suppose that (i) and (ii) hold for . We now wish to show that is 2-chordal bipartite. Suppose that contains a cycle of length greater than or equal to . As (i) is true, it must have at least one chord, which we will denote . Now consider . Clearly and so also contains a cycle of size 6 or greater. Moreover, by (ii) we have that this cycle contains a chord in . As is not an edge in , this chord must be a second chord of the cycle when viewed in itself and so we are done.
Conversely, if a graph is 2-chordal bipartite, then it automatically must satisfy (i). Supposing that (ii) is false for implies that there exists some edge for which fails to be chordal bipartite. In which case contains a cycle of length greater than or equal to 6, call it , which contains no chords. Consider the embedded image of in . As a cycle in it contains at most one more chord than it did in (namely ), hence it contains at most a single chord, contradicting the assumption that is 2-chordal bipartite. ∎
Theorem 3.2.
The 2-chordal Bipartite Checker Algorithm (Algorithm 1) returns True if and only if its input is a 2-chordal bipartite graph.
Proof.
We first show that that Algorithm 1 halts on any bipartite graph input. This amounts to showing that each while loop ends. We look first at the while loop on line 10. If the for loop on line 11 iterates through every vertex of (which is a finite set) then the variable flag is set to 2 and the while loop terminates followed by the algorithm returning false. If the for loop on line 11 fails to iterate through every vertex of , then line 16 must have been carried out. This requires that there is a vertex which satisfies the condition on line 12 (i.e. it’s simple) and so line 13 runs. This reduces the cardinality of the vertex set of and then resets the while loop. Therefore the while loop on line 10 must eventually break as there are only finitely many vertices to remove. There is only one other loop which could potentially prevent the algorithm from halting and it occur on line 23. However, this loop is a copy of the loop on line 10 and so it also ends.
Suppose that Algorithm 1 is run with input a 2-chordal bipartite graph . Note that if the algorithm terminates and the variable “flag” is never set equal to 2, then it returns True. Thus it is only necessary to show that flag is never set equal to 2. On line 17 we have that flag is set equal to 2. For this line of the algorithm to be run requires that the for loop on line 11 complete without resetting the while loop on line 10, i.e. the conditions of line 12 must never be satisfied for any vertex in . That is, contains no simple vertices. However, if contains no simple vertices then is not strongly chordal. In the algorithm, is the graph obtained from by adding edges between every pair of vertices in . Therefore, if fails to be strongly chordal, fails to be chordal bipartite. By Theorem 3.1, this implies that is not 2-chordal bipartite. This contradicts our assumption and so flag must not be set equal to 2 on line 17. The only other place flag can be set equal to 2 is on line 30. This requires that there exist an edge of our graph for which the graph obtained from by deleting fails to be chordal bipartite (the algorithm performs the same strongly chordal check). But this would imply that fails to satisfy condition (ii) of Theorem 3.1 and so cannot happen. Therefore, if Algorithm 1 is run with input a 2-chordal bipartite graph, then it outputs True.
Conversely if the Algorithm outputs True, then by running the above argument in reverse we find that conditions (i) and (ii) of the theorem are satisfied and so its input must have been a 2-chordal bipartite graph. ∎
4 k-chordal bipartite graphs
Theorem 3.1 has a natural generalization to -chordal bipartite graphs.
Theorem 4.3.
Given a bipartite graph , it is -chordal bipartite if and only if both of the following are true:
-
(i)
is chordal bipartite
-
(ii)
for each , the graph is -chordal bipartite.
We allow 0-chordal bipartite to be a vacuous truth of all graphs so that Theorem 4.3. is valid for all . We call an -chordal bipartite graph trivial if it contains no cycles of length 6 or greater. The proof of this theorem mirrors the 2-chordal bipartite case.
Proof.
We prove this by induction. We’ve already shown the base case, so let and suppose that the theorem holds for all natural numbers less than . Let be a bipartite graph and suppose that (i) and (ii) hold for the -chordal bipartite version of the theorem, i.e. is chordal bipartite and for each the graph is -chordal bipartite.
If has a cycle of size , then by (i) it contains a chord, call it . By (ii), contains chords and so the cycle in must contain all of those chords plus , i.e. at least chords. Therefore is -chordal bipartite.
Conversely, if is -chordal bipartite then it is chordal bipartite. Supposing that (ii) is false for implies that there exists an edge for which fails to be -chordal bipartite. That is, there is a cycle which contains at most chords. Considering the image of in we find that it contains at most chords, a contradiction. ∎
There is an important bound on the minimum cycle size for nontrivial -chordal bipartite graphs for large .
Lemma 4.4.
There does not exist a nontrivial -chordal bipartite graph containing a cycle of size exactly for .
This can easily be seen by noting that a cycle of size 6 is constructed from two sets of three vertices and can at most admit three chords, as shown in Figure 5.
Theorem 4.5.
For , there are no nontrivial -chordal bipartite graphs.
Proof.
Suppose that is a nontrivial -chordal bipartite graph for fixed . Then it contains some cycle of length greater than or equal to . If the length equals then we’ve arrived at a contradiction by Lemma 2.3. If the length is greater than then we can choose any one of the chords which subdivide the cycle and obtain two new cycles. If one of these cycles has a length greater than or equal to 6 (but is also necessarily of length less than the length of cycle ), then we restart the process replacing with this new smaller cycle.
If neither of the two cycles (which we will denote ) produced by the chord bisecting have length greater than or equal to , then we consider the following: (1) is a cycle of even length, (2) the length of is greater than by the above, and (3) . Therefore,
which implies that . The only way to partition into two natural numbers such that neither number is greater than or equal to is for . Thus, . We can draw the corresponding cycle and chord as in Figure 6.
However, Figure 6 cannot arise in a bipartite graph as there is no two-coloring of the vertices in the figure when the chord is present. Therefore, one of the two cycles formed by the chord dividing must have length greater than or equal to 6 yet less than the length of itself and so we’re returned to the case above.
As this process always decreases the length of the cycle and has lower bound equal to , then a finite iteration of this process must achieve said bound, leading to the contradiction by Lemma 2.3. ∎
5 Efficiency of the algorithm
Our attention now turns to the efficiency of the problem. Algorithm 1 is a naive implementation in that faster means of checking whether a graph is strongly chordal are known, in fact it can checked via the construction of a strong perfect elimination ordering. This construction is related to the problem of doubly lexical orderings of matrices and can be performed in time where is the cardinality of the vertex set and is the cardinality of the edge set [8] [9]. This allows us to check that a bipartite graph is chordal bipartite in time (as a graph is chordal bipartite if and only if the graph obtained by adding an edge between every pair of vertices in one of its partitions is strongly chordal). Thus, the decision problem is in complexity class P. The algorithm for determining whether a bipartite graph is 2-chordal bipartite amounts to iterating the chordal bipartite algorithm over the edge set of the bipartite graph. Within the loop the subgraph has one fewer edge but the same number of vertices.
Theorem 5.6 (2-chordal Bipartite Efifciency).
Given a bipartite graph , it can be checked whether or not it is 2-chordal bipartite in polynomial time on the vertex set alone.
Proof.
Let be our graph with vertices and edges. Let be the time it takes to produce an induced subgraph from (can be taken to be assuming operations are done on vertices and edges) and let be the time it takes to check whether is chordal bipartite. To check that is 2-chordal bipartite, we first check that is itself chordal bipartite and then check that all of its subgraphs created by deleting an edge are chordal bipartite. Then determining whether is 2-chordal bipartite can be done in
Therefore the 2-chordal bipartite problem is polynomial on the vertex and edge set. To show that it is polynomial on the vertex set, we note that for bipartite graphs is bounded by . This is because the complete bipartite graph contains edges and for a fixed number of total vertices, i.e. , the maximum is obtained when (or if is odd). These maxima are and respectively. So by replacing every above with we obtain a polynomial bound on the runtime in terms of the cardinality of the vertex set alone. ∎
Going a bit further, it’s reasonable to assume that is negligible compared to the other operations and that , in which case the above is . In other words, the process is as efficient as possible with the current characterization of 2-chordal bipartite graphs offered here. Like the -chordal bipartite problem, the -chordal bipartite problem, and the general -chordal bipartite problem, is polynomial in complexity on the vertex set alone and its runtime can be found by iterating this process giving
under the mild assumptions given above. A small corollary of Theorem 5.1 is that the induced subgraph problem for the double square graph is also in P.
References
- [1] A. Hajnal, J. Surányi, Über die auflösung von graphen in vollständige teilgraphen, Annales Univ. Sci. Budapest. Eötvös. Sect. Math. 1 (1958) 113–121.
- [2] J. Coons, S. Sullivant, Quasi-independence models with rational maximum likelihood estimator, Journal of Symbolic Computation 104 (2021) 917–941.
- [3] M. Farber, Characterizations of strongly chordal graphs, Discrete Mathematics 2 (1983) 173–189.
- [4] G. A. Dirac, On rigid circuit graphs, Abhandlungen aus dem Mathematischen Seminar der Universität Hamburg 25 (1961) 71–76.
- [5] M. Pelsmajer, J. Tokaz, D. West, New proofs for strongly chordal graphs and chordal bipartite graphs, preprint (2004).
- [6] D. Johnson, The np-completeness column: an ongoing guide, Journal of Algorithms 6 (1985) 434–454.
- [7] H. de Ridder et al., Information System on Graph Classes and their Inclusions (ISGCI), https://www.graphclasses.org (2018).
- [8] A. Lubiw, Doubly lexical orderings of matrices, SIAM Journal on Computing 16 (1987) 854–879.
- [9] R. Paige, R. Tarjan, Three partition refinement algorithms, SIAM Journal on Computing 16 (1987) 973–989.