1 Introduction an Preliminaries

Characterization and classification of Cohen–Macaulay graphs, specially bipartite graphs, have been extensively studied in the last decades (e.g., see [24, 6, 11]). A thorough background to the subject is provided in the above references and [9]. To make this note self-contained, we review some of the basic notions.

Throughout this paper, all graphs are finite and simple with no vertex of degree zero. Let \(G\) be a graph with vertex set \(V(G)\) and edge set \(E(G)\). For two adjacent vertices \(v\) and \(w\) in \(G\), we write \(v\sim w\). The set of all vertices of \(G\) adjacent to a vertex \(v\) is denoted by \(N(v)\). We say that a set \(F\subseteq V(G)\) is an independent set in \(G\) if no two vertices of \(F\) are adjacent. A set \(P\subseteq E(G)\) is called a perfect matching if there is no pair of distinct edges in \(P\) with a common vertex and any vertex in \(G\) belongs to one of the edges in \(P\). A graph \(G\) is called bipartite if \(V(G)=V\cup W\) such that \(V\cap W=\varnothing \) and both \(V\) and \(W\) and independent sets in \(G\). A bipartite graph is called complete bipartite if each vertex in \(V\) is adjacent to each vertex of \(W\).

Let \(G\) be a graph on the vertex set \(V(G) = \{v_1,\ldots ,v_n\}\). Let \(K\) be a field and \(S=K[x_1,\ldots ,x_n]\) the polynomial ring on \(n\) variables with coefficients in \(K\). The edge ideal \(I(G)\) of \(G\) is defined to be the ideal of \(S\) generated by all square-free monomials \(x_ix_j\), provided that \(v_i\sim v_j\) in \(G\). The quotient ring \(R(G)=S/I(G)\) is called the edge ring of the graph \(G\).

Let \([n] = \{1,2,\ldots ,n\}\). A (finite) simplicial complex \(\Delta \) on \(n\) vertices is a collection of subsets of \([n]\) such that the following conditions hold:

  1. (i)

    \(\{i\}\in \Delta \) for each \(i\in [n]\),

  2. (ii)

    if \(E\in \Delta \) and \(F\subseteq E\), then \(F\in \Delta \).

An element of \(\Delta \) is called a face, and a maximal face with respect to inclusion order is called a facet. The dimension of a face \(F\in \Delta \) is defined to be \(|F|-1\) and the dimension of \(\Delta \) is the maximum of the dimensions of its faces. Faces with dimension 0 are called vertices.

Let \(\Delta \) be a simplicial complex on \([n]\) and \(S=K[x_1,\ldots ,x_n]\). Let \(I_{\Delta }\) be the ideal of \(S\) generated by all square-free monomials \(x_{i_1}\cdots x_{i_s}\), provided that \(\{i_1,\ldots ,i_s\}\not \in \Delta \). The quotient ring \(K[\Delta ]=S/I_{\Delta }\) is called the Stanley–Reisner ring of the simplicial complex \(\Delta \). Let \(v_i\) be a vertex in a graph \(G\) and \(x_i\) be the corresponding variable in the polynomial ring. In this paper, we usually use \(x_i\) instead of \(v_i\). The same notation is used for vertices of a simplicial complex.

For a graph \(G\), there is a simplicial complex which is called independence complex of \(G\) and is defined by

$$\begin{aligned} \Delta _G = \{F \subseteq V : F \ \text{ is } \text{ an } \text{ independent } \text{ set } \text{ in } \ G\} . \end{aligned}$$

Let \(R\) be a commutative ring with an identity. The depth of \(R\), denoted by \(\text{ depth }(R)\), is the largest integer \(r\) such that there is a sequence \(f_1, \ldots , f_r\) of elements of \(R\) such that \(f_i\) is not a zero-divisor in \(S / (f_1, \ldots , f_{i-1})\) for all \(1\le i \le r\), and \((f_1, \ldots , f_r)\ne R\). Such a sequence is called a regular sequence. The depth is an important invariant of a ring. It is bounded by another important invariant, the Krull dimension of the ring denoted by \(\dim (R)\); the length of the longest chain of prime ideals in the ring. The ring \(R\) is called Cohen–Macaulay if \(\text{ depth }(R) = \dim (R)\). A graph \(G\) (a simplicial complex \(\Delta \), respectively) is called Cohen–Macaulay if the ring \(R(G)\) (the ring \(K[\Delta ]\), respectively) is Cohen–Macaulay. It is well known that \(\dim (K[\Delta ])=\dim (\Delta )+1\) (see [5]).

A simplicial complex \(\Delta \) is called pure if all its facets have the same cardinality. A graph \(G\) is called well covered or unmixed if all maximal independent sets of vertices of \(G\) have the same cardinality. It is clear that a graph \(G\) is unmixed if and only if the simplicial complex \(\Delta _G\) is pure. It is well known that a Cohen–Macaulay simplicial complex is pure ([5]), but the converse is not true, i.e., there are pure simplicial complexes which are not Cohen–Macaulay. Also it is known that if \(G\) is a Cohen–Macaulay graph, then \(\overline{G}\), the complement of \(G\), is connected [5].

A pure simplicial complex \(\Delta \) on vertex set \([n]\) is called completely balanced if there is a partition of \([n]\) as \(C_1,\ldots ,C_r\) such that each facet of \(\Delta \) has exactly one vertex in common with each \(C_i\). Here, a partition means that \(C_1\cup \cdots \cup C_r=[n]\), and for each \(i\ne j, \, C_i\cap C_j=\varnothing \). Such simplicial complexes were studied by R. Stanley [8]. He proved that, in a completely balanced simplicial complex with partition \(C_1, \ldots , C_r\), the elements \(\theta _1,\ldots ,\theta _r\) form a homogeneous system of parameters, where

$$\begin{aligned} \theta _i=\sum _{j\in C_i}\bar{x}_j, \end{aligned}$$

where \(\bar{x}_i\) denotes the image of \(x_i\) in \(K[\Delta ]\). By a homogeneous system of parameters in a standard graded ring \(R\), we mean a set of homogeneous elements \(\theta _1,\ldots ,\theta _r\) of nonzero degrees such that \(\dim (R/(\theta _1,\ldots ,\theta _r))=0\).

2 Main Results

M. Estrada and R. H. Villarreal in [2] have proved that, for a bipartite graph \(G\), Cohen–Macaulayness and shellability are equivalent, and if \(G\) is Cohen–Macaulay, then there is a vertex \(v\) in \(G\) such that \(G\setminus \{v\}\) is again Cohen–Macaulay.

Villarreal has proved in [12] that a bipartite graph \(G\) with parts \(V\) and \(W\) is unmixed if and only if \(|V|=|W|\) and there is an order on vertices of \(V\) and \(W\) as \(x_1, \ldots , x_n\) and \(y_1, \ldots , y_n\) respectively, such that

  1. (1)

    \(x_i\sim y_i\) for \(i=1, \ldots , n\),

  2. (2)

    for each \(1\le i<j<k\le n\) if \(x_i\sim y_j\) and \(x_j\sim y_k\), then \(x_i\sim y_k\). J. Herzog and T. Hibi in [4] have proved that a bipartite graph \(G\) is Cohen–Macaulay if and only if it is unmixed (has properties (1) and (2) above), and

  3. (3)

    if \(x_i\sim y_j\), then \(i\le j\).

In these results, one needs to find an appropriate order on the vertices of \(G\) for which the criterion holds. Therefore, checking the Cohen–Macaulayness of a given bipartite graph in practice is rather complicated. In this paper, we show that one can check Cohen–Macaulayness of a given bipartite graph in a quite easy way. We prove that a graph \(G\) is Cohen–Macaulay if and only if it is unmixed and has a unique perfect matching. These kind of graphs have applications in computational biology. The unique maximum-weight perfect matching can be used to predict the folding structure of RNA molecules (see [10]). Our main theorem is the following.

Theorem 2.1

Let \(G\) be a bipartite graph with parts \(V\) and \(W\). Then, \(G\) is Cohen–Macaulay if and only if there is a perfect matching in \(G\) as \(\{x_1,y_1\}, \ldots , \{x_n,y_n\}\), such that \(x_i\in V\) and \(y_i\in W\) for \(i=1,\ldots ,n\), and the following two conditions hold.

  1. (1)

    The induced subgraph on \(N(x_i)\cup N(y_i)\) is a complete bipartite graph, for \(i=1,\ldots ,n\).

  2. (2)

    If \(x_i\sim y_j\) for \(i\ne j\), then \(x_j\not \sim y_i\).

Before proving the theorem, we prove some preliminary lemmas.

Lemma 2.1

Let \(G\) be an unmixed bipartite graph with a perfect matching \(\{x_1,y_1\}, \ldots ,\) \(\{x_n,y_n\}\). Then, \(G\) is Cohen–Macaulay if and only if the sequence \(\bar{x}_1+\bar{y}_1, \ldots , \bar{x}_n+\bar{y}_n\) is a regular sequence in \(R(G)\).

Proof

The sets \(\{x_1,y_1\}, \ldots , \{x_n,y_n\}\) form a partition of vertices of \(G\) and any maximal independent set intersects each of them in exactly one vertex. Thus, the simplicial complex \(\Delta _{G}\) is completely balanced. By Corollary 4.2 and its remark in [8], the sequence \(x_1+y_1, \ldots , x_n+y_n\) is a system of parameters in \(R(G)\). By Theorem 17.4 in [7], \(R(G)\) is Cohen–Macaulay if and only if every system of parameters is a regular sequence in \(R(G)\). \(\square \)

Lemma 2.2

Let \(I\) be an ideal of \(S=K[x_1,\ldots ,x_n]\), generated by some quadratic monomials. Let for some \(i,j, \, 1\le i<j\le n, \, x_i^2\not \in I\) and \(x_j^2\not \in I\). Then, \(\bar{x}_i+\bar{x}_j\) is a zero-divisor in \(S/I\) if and only if one of the following conditions holds:

  1. (i)

    There is \(x_k, \, k\not \in \{i,j\}\) such that \(\bar{x}_k(\bar{x}_i+\bar{x}_j)=0\).

  2. (ii)

    There are integers \(k,l, \, 1\le k<l\le n\), both distinct from \(i\) and \(j\), such that \(x_kx_l\not \in I\) and \(\bar{x}_k\bar{x}_l(\bar{x}_i + \bar{x}_j)=0\).

Here, \(\bar{x}_i\) denotes the image of \(x_i\) in \(S/I\).

Proof

Without loss of generality, we may assume that \(i=1\) and \(j=2\). It is well known that a polynomial \(f\) in \(S\) belongs to a monomial ideal \(I\) if and only if all monomials of \(f\) belong to \(I\). Let \(\prec \) be the lexicographic order on monomials of \(S\) induced by \(x_1\succ x_2 \succ \cdots \succ x_n\). Let \(\bar{x}_1+\bar{x}_2\) be a zero-divisor in \(S/I\). Then, there is a polynomial \(h\) in \(S\) such that \(\bar{h}\) is nonzero in \(S/I\) and \(\bar{h}(\bar{x}_1+\bar{x}_2)=0\) or equivalently, \(f=h(x_1+x_2)\in I\). Let \(h=h_1+h_2+\cdots + h_r\) such that \(h_i\)s are monomials and \(h_1\succ h_2\succ \cdots \succ h_r\). We may assume that \(h_1\not \in I\). Now, \(h_1x_1\) is the greatest monomial of \(f\) with respect to the order \(\prec \) which cannot be canceled by other monomials. Therefore, \(h_1x_1\in I\) and there is a quadratic monomial in the monomial generating set of \(I\) which divides \(h_1x_1\) and does not divide \(h_1\). This monomial must be of the form \(x_1x_k\) for some \(k, \, 1< k\le n\). On the other hand, \(x_1\not \mid h_1\) because \(x_k|h_1\) and \(h_1\not \in I\). Since the order is lexicographic, \(x_1\) does not divide any other monomials in \(h\). Therefore, in the polynomial \(hx_1+hx_2\), there is no monomial of the summand \(hx_2\), which is divisible by \(x_1\). In this summand, \(h_1x_2\) is the greatest monomial with respect to \(\prec \) and can not be canceled by other monomials. This implies that \(h_1x_2\in I\). Similar to the above argument, there is a quadratic monomial in the generating set of \(I\) which divides \(h_1x_2\) but not \(h_1\). This monomial must be of the form \(x_2x_l\) for some \(2<l\le n\). We also have \(x_2\not \mid h_1\) but \(x_k|h_1\) and \(x_l|h_1\). If \(k=l\), then \(x_k(x_1+x_2)\in I\) and if \(k\ne l\), then \(x_kx_l(x_1+x_2)\in I\). Note that, \(x_kx_l\not \in I\) because \(x_kx_l|h_1\) and \(h_1\not \in I\). This completes the proof in one direction. The converse is trivial. \(\square \)

Proof of Theorem 2.1  We proceed the proof in 3 steps. First we prove that a bipartite graph \(G\) is unmixed if and only if there is a perfect matching in \(G\) satisfying condition 1. Then, in Step 2, we prove that for an unmixed bipartite graph, condition 2 is necessary for Cohen–Macaulayness. In Step 3 we prove that condition 2 is also sufficient for Cohen–Macaulayness of such a graph.

Step 1. Let \(G\) be unmixed. There is no isolated vertex and any vertex in \(V\) is adjacent to some vertices in \(W\). Therefore, there is no vertex in \(V\) independent to the set \(W\). This means that \(W\) is a maximal independent set in \(G\). Similarly, \(V\) is a maximal independent set. By unmixedness of \(G, \, |V|=|W|\). Let \(A\subseteq V\) be a nonempty set. Suppose \(|N(A)|< |A|\). There is no edge between \(A\) and \(W\setminus N(A)\). Therefore, \(A\cup (W\setminus N(A))\) is an independent set and its size is strictly greater than \(|W|\), which is a contradiction. Therefore, \(|N(A)| \ge |A|\) for each nonempty subset \(A\) of \(V\). Therefore, by the marriage theorem of Hall [1], there is a perfect matching between \(V\) and \(W\).

Now, let \(V=\{x_1,\ldots ,x_n\}, \, W=\{y_1,\ldots ,y_n\}\) and \(\{x_1,y_1\}, \ldots , \{x_n,y_n\}\) be a perfect matching in \(G\). The graph \(G\) is unmixed and any maximal independent set of vertices in \(G\) has cardinality \(n\). Therefore, any maximal independent set intersects each edge of the perfect matching in exactly one vertex. Suppose for some \(j, \, 1\le j\le n\), the induced subgraph on \(N(x_j)\cup N(y_j)\) is not a complete bipartite graph. Then, there are \(x\in N(y_j)\) and \(y\in N(x_j)\) such that \(x\not \sim y\). The set \(\{x,y\}\) is independent and so there is a maximal independent set containing it. But, this maximal independent set does not meet the edge \(\{x_j,y_j\}\) which is a contradiction. Therefore, condition 1 holds.

Conversely, assume that there is a perfect matching \(\{x_1,y_1\}, \ldots , \{x_n,y_n\}\) in \(G\) which satisfies condition 1. Let \(A\) be a maximal independent set in \(G\). Then \(A\) meets each edge in the perfect matching in at most one vertex. Suppose that for some \(j, \, 1\le j\le n, \, A\cap \{x_j,y_j\}=\varnothing \). Then, neither \(x_j\) nor \(y_j\) is independent to \(A\), and there are \(x,y\in A\) such that \(x\sim y_j\) and \(y\sim x_j\). But, \(x\) and \(y\) are not adjacent and the induced subgraph on \(N(x_j)\cup N(y_j)\) is not a complete bipartite graph, which is a contradiction. Therefore, \(A\) meets any edge in the perfect matching and has cardinality \(n\). It means that \(G\) is unmixed.

Step 2. Let \(G\) be a bipartite graph with a perfect matching which satisfies condition 1 but condition 2 fails. That is, for some \(i\) and \(j, \, 1\le i<j\le n\), we have \(x_i\sim y_j\) and \(x_j\sim y_i\). Then, in the quotient ring \(R(G)/(x_i + y_i)\), the element \(\bar{x}_i\) is nonzero and \(\bar{x}_i(\bar{x}_j+\bar{y}_j)=0\) because \(\bar{x}_i=-\bar{y}_i\). Therefore, \(\bar{x}_j+\bar{y}_j\) is a zero-divisor in \(R(G)/(x_i + y_i)\). This means that the sequence \(\bar{x}_1+\bar{y}_1, \ldots , \bar{x}_n+\bar{y}_n\) is not a regular sequence in \(R(G)\) and hence by Lemma 2.1, \(R(G)\) is not Cohen–Macaulay.

Step 3. Let \(G\) be a bipartite graph with a perfect matching satisfying condition 1. In this case, \(\dim (R(G))=n\) and to prove that \(R(G)\) is Cohen–Macaulay, it is enough to show that the sequence \(\bar{x}_1+\bar{y}_1, \ldots , \bar{x}_n+\bar{y}_n\) is a regular sequence in \(R(G)\) (Lemma 2.1). For an integer \(i, \, 1\le i< n\), the ring \(R(G)/(x_1+y_1,\ldots ,x_{i-1}+y_{i-1})\) can be viewed as the ring \(R'(G)\) obtained by \(R(G)\) identifying \(x_j\) with \(-y_j\) for \(j=1,\ldots ,i-1\). By the Lemma 2.2 and its proof, the only possibility for \(\bar{x}_i+\bar{y}_i\) to be zero-divisor in \(R'(G)\) is that there is \(j, \, 1\le j\le i-1\), such that \(\bar{x}_j(\bar{x}_i+\bar{y}_i)=0\). Therefore, \(\bar{x}_j\bar{y}_i=0\) and \(\bar{x}_j\bar{x}_i=0\) or equivalently, \(\bar{y}_j\bar{x}_i=0\). Therefore, \(x_j\sim y_i\) and \(y_j\sim x_i\). But, in this case, condition 2 fails. This completes the proof. \(\square \)

Proposition 2.1

Condition 1 in Theorem 1 which is equivalent to unmixedness of a bipartite graph is also equivalent to say that none of the polynomials \(x_1+y_1, \ldots , x_n+y_n\) is a zero-divisor in \(R(G)\).

Proof

The assertion is clear by the Lemma 2.2 and the Theorem 2.1. \(\square \)

Remark 2.1

Condition 2 in Theorem 1 is equivalent to say that, for each \(i\) and \(j, \, 1\le i<j\le n\), the induced subgraph on vertices \(\{x_i,y_i,x_j,y_j\}\) has connected complement.

Corollary 2.1

Let \(G\) be a bipartite Cohen–Macaulay graph and let \(\{x_i,y_i\}\) be any edge in the perfect matching mentioned in Theorem 1. Then, \(G\setminus \{x_i,y_i\}\) is again Cohen–Macaulay.

Proof

Here, by \(G\setminus \{x_i,y_i\}\) we mean the graph obtained by deleting vertices \(x_i\) and \(y_i\) and all edges passing through one of these vertices. It is clear that if condition 1 or 2 in Theorem 1 holds for \(G\), then it holds for \(G\setminus \{x_i,y_i\}\) for each \(i=1,\ldots ,n\). \(\square \)

Proposition 2.2

Let \(G\) be a bipartite Cohen–Macaulay graph with parts \(V\) and \(W\). Then, there is at least one vertex of degree one in each part.

Proof

Let \(y\) be a vertex in \(W\) such that for any other vertex \(y'\in W\), we have \(\deg (y')\le \deg (y)\). Let \(x\in V\) be the vertex such that \(\{x,y\}\) is in a perfect matching in \(G\). If \(\deg (x)>1\), then there is a vertex \(y'\in W\setminus \{y\}\) such that \(x\sim y'\). Let \(x'\) be a vertex in \(V\setminus \{x\}\) such that \(\{x',y'\}\) is in the perfect matching. Since \(G\) is Cohen–Macaulay, the induced subgraph on \(N(x)\cup N(y)\) is a complete bipartite graph and \(x'\not \in N(y)\). Then, \(y'\) is adjacent to each vertex in \(N(y)\cup \{x'\}\). This means that \(\deg (y')>\deg (y)\), which is a contradiction. Therefore, \(\deg (x)=1\). \(\square \)

Let \(G\) be a Cohen–Macaulay bipartite graph. There are some vertices in both parts with degree one. If we remove the vertex adjacent to a vertex of degree one, the edge consisting of these two vertices in a perfect matching will be removed and the remaining graph is also Cohen–Macaulay.

Corollary 2.2

Let \(G\) be a Cohen–Macaulay bipartite graph. Then, there is a unique perfect matching in \(G\).

Proof

Let \(V\) and \(W\) be two parts of \(G\). By the Theorem 1, there is a perfect matching. Let \(P\) be a perfect matching in \(G\). By the above proposition, there is a vertex \(x_1\) of degree one in \(V\). Let \(y_1\in W\) be the unique vertex adjacent to \(x_1\). Then \(\{x_1,y_1\}\in P\). The graph \(G\setminus \{x_1,y_1\}\) is again Cohen–Macaulay and \(V\setminus \{x_1\}\) has a vertex of degree one as \(x_2\). Let \(y_2\in W\setminus \{y_1\}\) be the unique vertex adjacent to \(x_2\). Then, \(\{x_2,y_2\}\in P\). Continuing this process, \(P\) will be uniquely determined. \(\square \)

Corollary 2.3

Let \(G\) be an unmixed bipartite graph. Then, the following conditions are equivalent.

  1. (i)

    \(G\) is Cohen–Macaulay.

  2. (ii)

    There is a unique perfect matching in \(G\).

  3. (iii)

    For each two edges \(e_1, e_2\) in a perfect matching, the complement of the induced subgraph on vertices of \(e_1\) and \(e_2\) is connected.

  4. (iv)

    For a perfect matching \(P\) in \(G\), there is an order on edges of \(P\) such that \(P=\{\{x_1,y_1\},\ldots ,\{x_n,y_n\}\}\) and \(x_i\sim y_j\) implies \(i\le j\).

Proof

(i\(\rightarrow \)ii) This is proved in Corollary 2.2. Let \(G\) be unmixed but not Cohen–Macaulay. Then, there is a perfect matching and two edges in the perfect matching as \(\{x_i,y_i\}\) and \(\{x_j,y_j\}\) such that \(x_i\sim y_j\) and \(x_j\sim y_i\). Substituting \(\{x_i,y_i\}\) and \(\{x_j,y_j\}\) by \(\{x_i,y_j\}\) and \(\{x_j,y_i\}\), we get a different perfect matching. This proves (ii\(\rightarrow \)i). The equivalence of (i) and (iii) is clear by Theorem 2.1 and Remark 2.1. To prove (i\(\rightarrow \)iv), let \(x_1, \ldots , x_n\) be vertices of \(V\) such that \(\deg (x_i)\ge \deg (x_{i+1})\) for each \(i=1,\ldots , n-1\). Then, \(\deg (y_1)=1\). Remove \(\{x_1,y_1\}\). In the remaining graph, \(\deg (y_2)=1\) and continuing this process shows that there is no any edge between \(x_i\) and \(y_j\) if \(i>j\). Finally, condition (iv) clearly implies condition (iii). \(\square \)

Now for a given bipartite graph \(G\), we present a fast polynomial-time algorithm to check whether \(G\) is Cohen–Macaulay.

Algorithm

Let \(G\) be a given bipartite graph with parts \(V\) and \(W, \, |V|=|W|=n\).

Step 1. :

Take \(i=0\).

Step 2. :

If there is no vertex with degree 1 in \(V\), go to Step 6.

Step 3. :

Set \(i=i+1\). Choose a vertex of degree one in \(V\) and name it \(x_i\). Name the vertex in \(W\) adjacent to \(x_i\) to be \(y_i\). Take \(V=V\setminus \{x_i\}, W=W\setminus \{y_i\}\). If \(i<n\), go to Step 2.

Step 4. :

If there is \(j, \, 2\le j\le n\) such that, a vertex in \(N(x_j)\) and a vertex in \(N(y_j)\) are not adjacent, then, go to Step 6.

Step 5. :

Write “G is Cohen–Macaulay” and end the algorithm.

Step 6. :

Write “G is not Cohen–Macaulay” and end the algorithm.