1 Introduction

Over the last two decades, the study of ideals with combinatorial origins has been an appealing trend in commutative algebra. One of the most well-studied types of such ideals which has attracted special attention in the literature is the binomial edge ideal of a graph.

Let G be a graph on [n] and \(S=\mathbb {K}[x_1 ,\ldots ,x_n , y_1 , \ldots , y_n]\) be the polynomial ring over a field \(\mathbb {K}\). Then, the binomial edge ideal associated with G, denoted by \(J_G\), is the ideal in S generated by all the quadratic binomials of the form \(f_{ij}=x_{i}y_{j}-x_{j}y_{i}\), where \(\{i,j\}\in E(G)\) and \(1\le i<j\le n\). This class of ideals was introduced in 2010 by Herzog, Hibi, Hreinsdóttir, Kahle and Rauh in [13], and independently by Ohtani in [21], as a natural generalization of determinantal ideals, as well as ideals generated by adjacent 2-minors of a \(2\times n\)-matrix of indeterminates.

Since then, many researchers have studied the algebraic properties and homological invariants of binomial edge ideals. The main goal is to understand how the invariants of the associated graph are reflected in the algebra of the ideal and vice versa. Indeed, it has been proved that there exists a mutual interaction between algebraic properties of binomial edge ideals and combinatorial properties of the underlying graphs, see, e.g., [1, 3, 5,6,7,8,9,10,11, 14, 15, 18, 20, 23,24,25,26] for some efforts in this direction.

One of the homological invariants associated with binomial edge ideals, which is not easy to compute, is depth. Recall that

$$\begin{aligned} \mathrm {depth}\, S/J_G=\min \left\{ i:H_{\mathfrak {m}}^{i}\left( S/J_G\right) \ne 0\right\} , \end{aligned}$$

where \(H_{\mathfrak {m}}^{i}(S/J_G)\) denotes the \(i^{th}\) local cohomology module of \(S/J_G\) with support at the maximal homogeneous ideal \(\mathfrak {m}=(x_1,\ldots ,x_n,y_1,\ldots ,y_n)\) of S.

Notice that unlike some other homological invariants associated with binomial edge ideals, like the Castelnuovo–Mumford regularity, which has been studied extensively, little is known about the depth of binomial edge ideals. Moreover, since the depth is in general dependent on the characteristic of the base field, finding some characteristic-free results about the depth of such homogeneous ideals is of great interest. In the following, we briefly summarize the results in this direction.

The first important result about the depth of binomial edge ideals appeared in [7], where the authors showed that \(\mathrm {depth}\, S/J_G=n+1\), where G is a connected block graph. Afterward, in [30] it was shown that \(\mathrm {depth}\, S/J_G=n\), where G is a cycle with more than 3 vertices. Later, this result was generalized in [17] for the so-called quasi-cycle graphs. Also, it was shown in [27] that the depth of the binomial edge ideal of a unicyclic graph is either n or \(n+1\), and all unicyclic graphs of depth n and \(n+1\) were characterized. In [19], by generalizing a formula for the depth of complete bipartite graphs in [28], the authors gave some precise formulas for the depth of the join product of graphs. In [3], Banerjee and Núñez-Betancourt established a nice combinatorial upper bound for the depth of binomial edge ideals in terms of the vertex connectivity of the underlying graph. Indeed, for a non-complete connected graph G, they showed that

$$\begin{aligned} \mathrm {depth}\, S/J_G\le n-\kappa (G)+2, \end{aligned}$$
(1)

where \(\kappa (G)\) denotes the vertex connectivity of G, which is the minimum number of vertices of G whose removal makes G disconnected.

It is worth mentioning here that to the best of our knowledge, besides the above combinatorial upper bound for the depth of binomial edge ideals, there is no combinatorial lower bound for the depth of \(S/J_G\). So, as the first main result of this paper, we supply the following combinatorial lower bound for the depth of binomial edge ideals:

Theorem A

(Theorem 3). Let G be a graph on [n]. Then,

$$\begin{aligned} \mathrm {depth}\, S/J_G\ge \xi (G). \end{aligned}$$

In particular, if G is connected, then

$$\begin{aligned} \mathrm {depth}\, S/J_G\ge f(G)+\mathrm {diam}(G). \end{aligned}$$

Here, \(\xi (G)=f(G)+d(G)\) where f(G) denotes the number of free vertices (or simplicial vertices) of the graph G, and d(G) denotes the sum of the diameters of the connected components of G, and the number of the isolated vertices of G. Moreover, \(\mathrm {diam}(G)\) denotes the diameter of G.

In order to prove Theorem A, we first introduce the concept of d-compatible maps. Such maps are defined from the set of all graphs to the set of nonnegative integers that admit certain properties (see Definition 1). Then, we exploit this concept to establish a general lower bound for the depth of binomial edge ideals. We also provide a combinatorial d-compatible map, which yields the above lower bound. We also show that our lower bound is best possible in the sense that there are graphs G for which \(\mathrm {depth}\, S/J_G=\xi (G)\), see Figs. 1 and 2.

Fig. 1
figure 1

A graph G with \(\mathrm {depth}\, S/J_G=\xi (G)=n-\kappa (G)+2=12\)

Fig. 2
figure 2

A graph G with \(\mathrm {depth}\, S/J_G=\xi (G)=8<n-\kappa (G)+2=9\)

Now, we would like to mention another motivation of this paper. In [23], the authors of the present paper provided a general lower bound for the depth of binomial edge ideals. Indeed, they showed that \(\mathrm {depth}\, S/J_G\ge 4\), where G is a connected graph with at least three vertices. Moreover, they gave an explicit characterization of the graphs G for which \(\mathrm {depth}\, S/J_G=4\). More precisely, they showed that for graphs G with more than three vertices, \(\mathrm {depth}\, S/J_G=4\) if and only if \(G=G'*2K_1\), for some graph \(G'\), where \(G'*2K_1\) denotes the join product of a graph \(G'\) and two isolated vertices denoted by \(2K_1\).

Now, it is natural to ask about a combinatorial characterization of binomial edge ideals of higher depths. In this paper, by using a wonderful Hochster-type formula for the local cohomology modules of binomial edge ideals provided by Àlvarez  Montaner in [1], we give such a characterization. Indeed, we prove the following characterization of the graphs G for which \(\mathrm {depth}\, S/J_G=5\), see Definition 4 for the required notation.

Theorem B

(Theorem 5). Let G be a graph on [n] with \(n\ge 5\). Then, the following statements are equivalent:

  1. (a)

    \(\mathrm {depth}\, S/J_G=5\).

  2. (b)

    G is a \(D_5\)-type graph.

The proof of Theorem B involves some topological results that we obtain in this paper about some specific subposets of a poset associated with binomial edge ideals, which are indeed of independent interest.

The organization of this paper is as follows. In Sect. 2, we fix the notation and review some facts and definitions that will be used throughout the paper.

In Sect. 3, toward providing some lower bounds for the depth of binomial edge ideals, in Definition 1, we introduce a concept which is named as d-compatible maps. Such maps are defined from the set of all graphs to the set of nonnegative integers with some specific properties. Then, in Theorem 1, by using the aforementioned concept, a general lower bound is given for the depth of binomial edge ideals. In addition, after providing a combinatorial d-compatible map in Theorem 2, a combinatorial lower bound is given for the depth of binomial edge ideals in Theorem 3. This bound, together with a result from [23], provides a modified version of the bound given in Theorem 3.

In Sect. 4, following the poset theoretical as well as the topological approaches used in [1] and [23], we associate a new poset with binomial edge ideals in Definition 2. Then, we state in Theorem 4, the Hochster-type formula for the local cohomology modules of binomial edge ideals arose from [1, Theorem 3.9].

In Sect. 5, we use the Hochster-type formula provided in Sect. 4 to characterize all graphs G for which \(\mathrm {depth}\, S/J_G=5\), in Theorem 5. To prove our characterization, we need to provide several auxiliary ingredients. In particular, Theorem 6, which studies the vanishing of the zeroth and the first reduced cohomology groups of some subposets of the associated poset with binomial edge ideals, plays a crucial role in the proof of Theorem 5.

2 Preliminaries

In this section, we recall some notions and known facts that are used in this paper.

Graph theory Throughout the paper, all graphs are assumed to be simple (i.e., with no loops, directed and multiple edges). Let G be a graph on the vertex set [n] and \(T\subseteq [n]\). A subgraph H of G on the vertex set T is called an induced subgraph of G, whenever for any two vertices \(u,v\in T\), one has \(\{u,v\}\in E(H)\) if \(\{u,v\}\in E(G)\). Now, by \(G-T\), we mean the induced subgraph of G on the vertex set \([n]\backslash T\). In the special case, when \(T=\{v\}\), we use the notation \(G-v\) instead of \(G-\{v\}\), for simplicity.

Let \(v\in [n]\). Denoted by \(N_G(v)\) is the set of all vertices of G which are adjacent to v. We say that v is a free vertex (or simplicial vertex) of G, if the induced subgraph of G on the vertex set \(N_G(v)\) is a complete graph. Moreover, a vertex, which is not free, is called a non-free (or non-simplicial) vertex. We use f(G) and iv(G) to denote the number of free vertices and the number of non-free vertices of a graph G, respectively.

A vertex \(v\in [n]\) is said to be a cut vertex of G whenever \(G-v\) has more connected components than G. Moreover, we say that T has the cut point property for G, whenever each \(v\in T\) is a cut vertex of the graph \(G-(T\backslash \{v\})\). Particularly, the empty set \(\emptyset \) has the cut point property for G.

Let \(G_1\) and \(G_2\) be two graphs on the disjoint vertex sets \(V(G_1)\) and \(V(G_2)\), respectively. Then, by the join product of \(G_1\) and \(G_2\), denoted by \(G_1*G_2\), we mean the graph on the vertex set \(V(G_1)\cup V(G_2)\) and with the edge set

$$\begin{aligned} E\left( G_1\right) \cup E\left( G_2\right) \cup \left\{ \{u,v\}: u\in V\left( G_1\right) ~\mathrm {and}~v\in V\left( G_2\right) \right\} . \end{aligned}$$

Primary decomposition of binomial edge ideals Let G be a graph on [n] and \(T\subseteq [n]\). Let also \(G_1 , \ldots , G_{c_G(T)}\) be the connected components of \(G-T\) and \(\widetilde{G}_1 , \ldots , \widetilde{G}_{c_G(T)}\) be the complete graphs on the vertex sets \(V(G_1), \ldots , V(G_{c_G(T)})\), respectively. Let

$$\begin{aligned} P_T(G)=\left( x_v,y_v\right) _{v\in T} +J_{\widetilde{G}_1}+\cdots +J_{\widetilde{G}_{c_G(T)}}. \end{aligned}$$

Then, by [13, Theorem 3.2], it is known that \(J_{G}=\bigcap \limits _{\begin{array}{c} T\subseteq [n] \end{array}}P_T(G)\). Moreover, in [13, Corollary 3.9], all the minimal prime ideals of \(J_G\) were determined. Indeed, it was shown that \(P_T(G)\in \mathrm {Min}(J_G)\) if and only if \(T\in \mathscr {C}(G)\), where

$$\begin{aligned} \mathscr {C}(G)=\left\{ T\subseteq [n]:T~\mathrm {has~the~cut~point~property~for}~G\right\} . \end{aligned}$$

Finally, the following useful formula could be easily verified:

$$\begin{aligned} \mathrm {ht}P_T(G)=n-c_G(T)+|T|. \end{aligned}$$

Poset topology Let \(\Delta \) be a simplicial complex. Then, by the 1-skeleton graph of \(\Delta \) we mean the subcomplex of \(\Delta \) consisting of all the faces of \(\Delta \) which have cardinality at most 2. The simplicial complex \(\Delta \) is said to be connected if its 1-skeleton graph is connected.

Let \((\mathscr {P},\preccurlyeq )\) be a poset. Recall that the order complex of \(\mathscr {P}\), denoted by \(\Delta (\mathscr {P})\), is the simplicial complex whose facets are the maximal chains in \(\mathscr {P}\). We say that \(\mathscr {P}\) is a connected poset if its order complex \(\Delta (\mathscr {P})\) is connected. Similarly, we say that \(\mathscr {P}\) is contractible if \(\Delta (\mathscr {P})\) is contractible. If \(\mathscr {P}\) is an empty poset, then we consider \(\Delta (\mathscr {P})=\{\emptyset \}\), i.e., the empty simplicial complex.

Mayer–Vietoris sequence Let \(\Delta \) be a simplicial complex and \(v\in V(\Delta )\). Recall the following three subcomplexes of \(\Delta \) that will be used in this paper.

  • \(\mathrm {star}_\Delta (v)=\{\sigma \in \Delta : \sigma \cup \{v\}\in \Delta \}\);

  • \(\mathrm {del}_\Delta (v)=\{\sigma \in \Delta : v\not \in \sigma \}\);

  • \(\mathrm {link}_\Delta (v)=\{\sigma \in \Delta : v\not \in \sigma \hbox { and } \sigma \cup \{v\}\in \Delta \}\).

Let \(\Delta _1=\mathrm {star}_\Delta (v)\) and \(\Delta _2=\mathrm {del}_\Delta (v)\). Then, \(\Delta _1\cup \Delta _2=\Delta \) and \(\Delta _1\cap \Delta _2=\mathrm {link}_\Delta (v)\), and we have the Mayer–Vietoris sequence:

$$\begin{aligned}&\cdots \rightarrow H_{i}(\mathrm {link}_\Delta (v);\mathbb {K}) \rightarrow H_i(\mathrm {star}_\Delta (v);\mathbb {K})\oplus H_i(\mathrm {del}_\Delta (v);\mathbb {K})\rightarrow \\&H_i(\Delta ;\mathbb {K})\rightarrow H_{i-1}(\mathrm {link}_\Delta (v);\mathbb {K})\rightarrow \cdots \end{aligned}$$

Moreover, we have the reduced version

$$\begin{aligned} \cdots \rightarrow \widetilde{H}_{0}\left( \mathrm {link}_\Delta (v);\mathbb {K}\right) \rightarrow \widetilde{H}_0\left( \mathrm {star}_\Delta (v);\mathbb {K}\right) \oplus \widetilde{H}_0\left( \mathrm {del}_\Delta (v);\mathbb {K}\right) \rightarrow \widetilde{H}_0(\Delta ;\mathbb {K})\rightarrow 0, \end{aligned}$$

provided that \(\Delta _1\cap \Delta _2\ne \{\emptyset \}\).

3 A combinatorial lower bound for the depth of binomial edge ideals

Our main goal in this section is to establish some lower bounds for the depth of binomial edge ideals. We first introduce the concept of d-compatible maps, which are defined from the set of all graphs to the set of nonnegative integers \(\mathbb {N}_0\) with some desirable properties. Then, considering this concept, we give a general lower bound for the depth of binomial edge ideals. We also provide a combinatorial d-compatible map to obtain a combinatorial lower bound for the depth of such ideals as well.

We first introduce a graph that plays an important role in proving the main theorem of this section. Let G be a graph on [n] and \(v\in [n]\). Associated with the vertex v, there is a graph, denoted by \(G_{v}\), with the vertex set V(G) and the edge set

$$\begin{aligned} E(G)\cup \left\{ \{u,w\}: \{u,w\}\subseteq N_{G}(v)\right\} . \end{aligned}$$

Note that by the definition, it is clear that v is a free vertex of the graph \(G_v\), and \(N_G(v)=N_{G_v}(v)\).

Now, we are ready to define the notion of a d-compatible map. In the following, by \(K_t\) we mean the complete graph on t vertices, for every \(t\in \mathbb {N}\).

Definition 1

Let \(\mathscr {G}\) be the set of all graphs. A map \(\psi :\mathscr {G}\longrightarrow \mathbb {N}_0\) is called d-compatible, if it satisfies the following conditions:

  1. (a)

    if \(G=\dot{\cup }_{i=1}^{t}K_{n_i}\), where \(n_i\ge 1\) for every \(1\le i\le t\), then \(\psi (G)\le t+\sum _{i=1}^{t}n_i\);

  2. (b)

    if \(G\ne \dot{\cup }_{i=1}^{t}K_{n_i}\), then there exists a non-free vertex \(v\in V(G)\) such that

    1. (1)

      \(\psi (G-v)\ge \psi (G)\), and

    2. (2)

      \(\psi (G_v)\ge \psi (G)\), and

    3. (3)

      \(\psi (G_{v}-v)\ge \psi (G)-1\).

We also use the following lemma from [16]. In the following, iv(G) denotes the number of non-free vertices of a graph G.

Lemma 1

[16, Lemma 3.4] Let G be a graph and v be a non-free vertex of G. Then, \(\max \{iv(G_v), iv(G-v), iv(G_{v}-v)\}< iv(G)\).

The following theorem provides a general lower bound for the depth of binomial edge ideals.

Theorem 1

Let G be a graph on [n] and \(\psi \) a d-compatible map. Then,

$$\begin{aligned} \mathrm {depth}\, S/J_G\ge \psi (G). \end{aligned}$$

Proof

We prove the assertion by using induction on iv(G). If \(iv(G)=0\), then G is a disjoint union of complete graphs, that is, \(G=\dot{\cup }_{i=1}^{t}K_{n_i}\), where \(n_i\ge 1\) for every \(1\le i\le t\). We have \(\mathrm {depth}\, S/J_G=t+\sum _{i=1}^{t}n_i\), by [7, Theorem 1.1]. On the other hand, by condition (a) of Definition 1 we have \(\psi (G)\le t+\sum _{i=1}^{t}n_i\), so that the assertion holds in this case. Now, we assume that \(iv(G)>0\). Let \(v\in [n]\) be a non-free vertex with the properties of condition (b) of Definition 1.

By [21, Lemma 4.8], we have \(J_G=J_{G_v}\cap ((x_v,y_v) + J_{G-v})\). Therefore, the short exact sequence

$$\begin{aligned} 0\longrightarrow \dfrac{S}{J_G}\longrightarrow \dfrac{S}{J_{G_v}}\oplus \dfrac{S_v}{J_{G-v}} \longrightarrow \dfrac{S_v}{J_{{G_v}-v}}\longrightarrow 0 \end{aligned}$$

is induced, where \(S_v=\mathbb {K}[x_i,y_i:i\in [n]\backslash \{v\}]\).

Now, the well-known depth lemma implies that

$$\begin{aligned} \mathrm {depth}\, S/J_G\ge \min \{\mathrm {depth}\,S/J_{G_v}, \mathrm {depth}\,S_v/J_{G-v}, \mathrm {depth}\,S_v/J_{G_v-v}+1\}. \end{aligned}$$
(2)

Moreover, by Lemma 1, induction hypothesis and by Definition 1 part (b), we have

$$\begin{aligned}&\mathrm {depth}\, S/J_{G_v}\ge \psi (G_v)\ge \psi (G), \end{aligned}$$
(3)
$$\begin{aligned}&\mathrm {depth}\,S_v/J_{G-v}\ge \psi (G-v)\ge \psi (G) \end{aligned}$$
(4)

and

$$\begin{aligned} \mathrm {depth}\,S_v/J_{G_v-v}\ge \psi (G_{v}-v)\ge \psi (G)-1. \end{aligned}$$
(5)

So, (2) together with (3), (4) and (5) imply the result. \(\square \)

Now, we are going to provide a combinatorial d-compatible map. Before that, we need to recall the concept of diameter of a connected graph. Let G be a connected graph on [n] and u and v be two vertices of G. Then, by the distance between the vertices u and v in G, which is denoted by \(d_G(u,v)\), we mean the length of a shortest path connecting u and v in G. Now, the diameter of G, denoted by \(\mathrm {diam}(G)\), is defined as

$$\begin{aligned} \mathrm {diam}(G)=\max \left\{ d_G(u,v): u,v \in V(G)\right\} . \end{aligned}$$

We call a shortest path between two vertices u and v of G with \(d_G(u,v)=\mathrm {diam}(G)\), an LSP in G.

Let G be a graph on [n] with the connected components \(G_1,\ldots ,G_t\). Then, we set

$$\begin{aligned} d(G):=\mathfrak {i}(G)+\sum _{i=1}^{t}\mathrm {diam}(G_i), \end{aligned}$$

where \(\mathfrak {i}(G)\) denotes the number of isolated vertices of G.

Now, in the next theorem, we provide a d-compatible map given by \(\xi (G)\). Here, f(G) denotes the number of free vertices of G.

Theorem 2

The map \(\xi :\mathscr {G}\longrightarrow \mathbb {N}_0\) defined by

$$\begin{aligned} \xi (G)=f(G)+d(G),~\text {for~every}~G\in \mathscr {G} \end{aligned}$$

is d-compatible.

Proof

Let \(G\in \mathscr {G}\). First, assume that \(G=\dot{\cup }_{i=1}^{t}K_{n_i}\), where \(n_i\ge 1\) for every \(1\le i\le t\). Clearly, we have \(f(G)= \sum _{i=1}^{t}n_i\) and \(d(G)=t\), and hence \(\xi (G)=t+\sum _{i=1}^{t}n_i\). Therefore, we just need to show that \(\xi \) satisfies condition (b) of Definition 1. To do so, without loss of generality we assume that G is a non-complete connected graph. Therefore, we have \(d(G)=\mathrm {diam}(G)\). For convenience, we set \(d=d(G)\). Notice that \(d\ge 2\), since G is not a complete graph.

First, we show that there exists a non-free vertex \(v\in [n]\) such that \(\xi (G-v)\ge \xi (G)\). It is clear that for any non-free vertex v, we have \(f(G-v)\ge f(G)\). If there exists a non-free vertex \(v\in [n]\) such that v does not belong to the vertex set of some LSP in G, then v is certainly a vertex with the desired property. So, we may assume that every non-free vertex of G belongs to the vertex set of every LSP in G. Let \(P:v_1,v_2, \ldots ,v_{d+1}\) be an arbitrary LSP in G. Notice that \(v_i\) is a non-free vertex of G for every \(2\le i \le d\). Also, every vertex v of G which is not on the path P is a free vertex of G. These imply that for every \(2\le j \le d\), the vertices \(v_{j-1}\) and \(v_{j+1}\) belong to two different connected components of the graph \(G-v_j\). Indeed, assume on contrary that there exists a path \(P':v_{j-1},u_1,\ldots ,u_t,v_{j+1}\) in the graph \(G-v_j\). Without loss of generality, we may assume that \(P'\) is an induced path in \(G-v_j\). This clearly implies that \(\{u_1,\ldots ,u_t\}\subseteq V(P)\setminus \{v_j\}\). So, we have that \(u_1=v_{j-2},u_2=v_{j-3},\ldots ,u_t=v_{j-t-1}\). Thus, \(\{v_{j-t-1},v_{j+1}\}\in E(G)\), a contradiction.

Now, let \(2\le j \le d\), and \(\{n_j,v_j\}\in E(G)\), where \(n_j\in [n]\setminus V(P)\). By a similar argument, one could see that \(d_{G-v_{j+1}}(n_j,v_1)=j\), if \(\{n_j,v_{j-1}\}\notin E(G)\), and \(d_{G-v_j}(n_j,v_1)=j-1\), if \(\{n_j,v_{j-1}\}\in E(G)\). Also, we have \(d_{G-v_{j-1}}(n_j,v_{d+1})=d-j+2\), if \(\{n_j,v_{j+1}\}\notin E(G)\), and \(d_{G-v_j}(n_j,v_{d+1})=d-j+1\), if \(\{n_j,v_{j+1}\}\in E(G)\). We use these facts throughout the proof.

Now, assume that there exists \(2\le i\le d\) such that \(N_G(v_i)\cap N_G(v_{i+1})\ne \emptyset \). Let \(j=\min \{i: 2\le i\le d, N_G(v_i)\cap N_G(v_{i+1})\ne \emptyset \}.\) We claim that \(v_j\) is a vertex with the desired property. To prove the claim, we distinguish the following cases:

First assume that \(j>3\). Let \(n_j\in N_G(v_j)\cap N_G(v_{j+1})\). We have \(d_{G-v_j}(n_j,v_{d+1})=d-j+1\). Now, if \(v_{j-1}\) is a free vertex of \(G-v_j\), we have \(f(G-v_j)\ge f(G)+1\). On the other hand, we have that \(d(G-v_j)\ge j-2+d_{G-v_j}(n_j,v_{d+1})=d-1\), since the vertices \(v_{j-1}\) and \(v_{j+1}\) are contained in two connected components of the graph \(G-v_j\). So, we get \(f(G-v_j)+d(G-v_j)\ge f(G)+1+d-1=f(G)+d\), as desired. Now, if \(v_{j-1}\) is a non-free vertex of \(G-v_j\), then there exists \(n_{j-1}\in N_{G-v_j}(v_{j-1})\) such that \(n_{j-1}\) is not on the path P. Since \(j-2\ge 2\), by the choice of j, we have that \(\{n_{j-1},v_{j-2}\}\notin E(G)\). This implies that \(d_{G-v_j}(v_1,n_{j-1})=j-1\), and hence, \(d(G-v_j)\ge j-1+d_{G-v_j}(n_j,v_{d+1})=d\), which proves the claim in this case.

Next suppose that \(j=3\). Let \(n_3\in N_G(v_3)\cap N_G(v_{4})\). If \(v_2\) is a free vertex of \(G-v_3\), then the claim follows by the same argument of the previous case. If \(v_2\) is a non-free vertex of \(G-v_3\), there exists an induced path \(P'':\alpha ,v_2,\beta \) in \(G-v_3\). Therefore, \(d(G-v_3)\ge 2+d_{G-v_3}(n_3,v_{d+1})=d\). This implies the claim.

Finally, suppose that \(j=2\), and let \(n_2\in N_G(v_2)\cap N_G(v_{3})\). Then, \(d_{G-v_2}(n_2,v_{d+1})=d-1\). Therefore, since \(v_1\) and \(v_3\) belong to two connected components of \(G-v_2\), we get \(d(G-v_2)\ge 1+d-1=d\), as desired.

Now, we assume that \(N_G(v_i)\cap N_G(v_{i+1})=\emptyset \), for every \(2\le i\le d\). We show that \(v_2\) is a vertex with the desired property. First, notice that either \(v_3\) is a free vertex of \(G-v_2\), or there exists a vertex \(n_3\) such that \(\{n_3,v_3\}\in E(G)\) and \(\{n_3,v_4\}\notin E(G)\). This implies that either \(f(G-v_2)\ge f(G)+1\) which completes the proof in this case or \(d_{G-v_2}(n_3,v_{d+1})=d-1\).

Now, for the rest of the proof, we show that all non-free vertices of G satisfy conditions (2) and (3) of Definition 1. Suppose that v is an arbitrary non-free vertex of G.

First, we prove that \(\xi (G_v)\ge \xi (G)\). Notice that \(f(G_v)\ge f(G)+1\), by Lemma 1. Therefore, the result follows if we show that \(d(G_v)\ge d-1\). Let \(\alpha \) and \(\beta \) be two vertices of G with \(d_G(\alpha ,\beta )=d\). It suffices to show that \(d_{G_v}(\alpha ,\beta )\ge d-1\). Assume on contrary that there exists a path \(P:\alpha =u_1,u_2, \ldots ,u_{\ell +1}=\beta \) in \(G_v\) with \(\ell \le d-2\). Without loss of generality, we may assume that P is an induced path in \(G_v\). Now, we consider the following cases:

First, assume that \(v\in V(P)\). This clearly implies that \(v=\alpha \) or \(v=\beta \), since v is a free vertex of \(G_v\). Therefore, P is a path in G. So, we have that \(d_G(\alpha ,\beta )\le d-2\), a contradiction.

Next, assume that \(v\notin V(P)\). Now, since P is an induced path in \(G_v\) and since P is not a path in G, we get \(|N_{G_v}(v)\cap V(P)|=2\). Therefore, \(N_{G_v}(v)\cap V(P)=\{u_i,u_{i+1}\}\) for some \(1\le i \le \ell \). Now, the path \(P':\alpha =u_1,\ldots ,u_i,v,u_{i+1},\ldots ,u_{\ell +1}=\beta \) is a path in G between \(\alpha \) and \(\beta \) with the length at most \(d-1\), which is a contradiction.

So, we have \(d_{G_v}(\alpha ,\beta )\ge d-1\), as desired.

Finally, we show that \(\xi (G_{v}-v)\ge \xi (G)-1\). To prove this, it is enough to show that \(d(G_{v}-v)\ge d-1\), since \(f(G_{v}-v)\ge f(G)\) by Lemma 1. Let \(P:v_1,v_2, \ldots ,v_{d+1}\) be an LSP in G. We consider the following cases:

First, assume that \(v \ne v_1\) and \(v\ne v_{d+1}\). We show that \(d_{G_{v}-v}(v_1,v_{d+1})\ge d-1\). Suppose on contrary that \(d_{G_{v}-v}(v_1,v_{d+1})\le d-2\). Therefore, there exists a path \(P'\) in \(G_{v}-v\) between the vertices \(v_1\) and \(v_{d+1}\) with the length at most \(d-2\). We may also assume that \(P'\) is an induced path in \(G_{v}-v\). Since v is a free vertex of \(G_v\) and since \(P'\) is not a path in G, the vertex v has exactly two adjacent neighbors in G on the path \(P'\). This implies that \(d_G(v_1,v_{d+1})\le d-1\), a contradiction.

Next, without loss of generality we assume that \(v=v_1\). Now, the result follows if we show that \(d_{G_{v}-v}(v_2,v_{d+1})\ge d-1\). Assume on contrary that there exists an induced path \(P'':v_2,u_1,\ldots ,u_r=v_{d+1}\) in \(G_{v}-v\) between the vertices \(v_2\) and \(v_{d+1}\) with the length r, where \(r\le d-2\). Now, we have either \(N_{G_v}(v)\cap V(P'')=\{v_2\}\) or \(N_{G_v}(v)\cap V(P'')=\{v_2,u_1\}\). Therefore, we get a path in G between \(v_1\) and \(v_{d+1}\), with the length at most \(d-1\), and hence \(d_G(v_1,v_{d+1})\le d-1\), a contradiction.

So, we have \(d(G_{v}-v)\ge d-1\), as desired. \(\square \)

Now, combining of Theorem 1 and Theorem 2, we get the following combinatorial lower bound for the depth of binomial edge ideals.

Theorem 3

Let G be a graph on [n]. Then,

$$\begin{aligned} \mathrm {depth}\, S/J_G\ge \xi (G). \end{aligned}$$

In particular, if G is connected, then

$$\begin{aligned} \mathrm {depth}\, S/J_G\ge f(G)+\mathrm {diam}(G). \end{aligned}$$

We would like to remark that the lower bound in Theorem 3 could be tight. For instance, let G be the graph illustrated in Fig. 1. Then, \(f(G)=8\) and \(\mathrm {diam}(G)=4\), and hence, \(\mathrm {depth}\, S/J_G\ge \xi (G)=12\), by Theorem 3. On the other hand, the upper bound given in (1) implies that \(\mathrm {depth}\, S/J_G\le |V(G)|+1=12\), since \(\kappa (G)=1\). Therefore, we get \(\mathrm {depth}\, S/J_G=12\).

It is also remarkable that there are connected graphs G on [n] for which the lower bound given in Theorem 3 is attained, while \(\mathrm {depth}\, S/J_G <n-\kappa (G)+2\). For instance, let G be the graph depicted in Fig. 2 with \(f(G)=\mathrm {diam}(G)=4\). Then, a routine computation with Macaulay2 [12] over the base field \(\mathbb {Q}\) shows that \(\mathrm {depth}\, S/J_G=\xi (G)=8\), whereas \(n-\kappa (G)+2=9\).

We should also remark that there are both Cohen–Macaulay and non-Cohen–Macaulay graphs G with \(\mathrm {depth}\, S/J_G>\xi (G)\). For example, for the illustrated graph G in Fig. 3 with \(\xi (G)=5\), a computation with Macaulay2 [12] (see also [19, Theorem 3.9]) shows that \(S/J_G\) is Cohen–Macaulay, which yields that \(\mathrm {depth}\, S/J_G=~6\). On the other hand, for the non-Cohen–Macaulay graph G depicted in Fig. 4, we have \(\mathrm {depth}\, S/J_G=5>\xi (G)=2\), see Theorem 5. Moreover, there are Cohen–Macaulay and non-Cohen–Macaulay graphs G with \(\mathrm {depth}\, S/J_G=\xi (G)\). Indeed, one could easily see that all graphs G satisfying equivalent conditions of [7, Theorem 3.1] are Cohen–Macaulay with \(\mathrm {depth}\, S/J_G=\xi (G)\). Also, the graph G depicted in Fig. 2 is non-Cohen–Macaulay with \(\mathrm {depth}\, S/J_G=\xi (G)=8\).

Fig. 3
figure 3

A Cohen–Macaulay graph G with \(\mathrm {depth}\, S/J_G=6>\xi (G)=5\)

Fig. 4
figure 4

A \(D_5\)-type graph G with \(G\in \mathscr {G}_T\), where \(T=V(G)\setminus \{u,w\}\)

Now, combining Theorem 3 together with [23, Theorem 5.2] yields the following bound for the depth of binomial edge ideals.

Corollary 1

Let G be a graph on [n] with \(n\ge 3\). Then,

$$\begin{aligned} \mathrm {depth}\, S/J_G\ge \max \{4,\xi (G)\}. \end{aligned}$$

Moreover, in [23, Theorem 5.3], it was shown that for graphs G with more than three vertices, \(\mathrm {depth}\, S/J_G=4\) if and only if \(G=G'*2K_1\) for some graph \(G'\). Therefore, we have:

Corollary 2

Let G be a graph on [n] with \(n\ge 4\) and \(G\ne G'*2K_1\) for every graph \(G'\). Then,

$$\begin{aligned} \mathrm {depth}\, S/J_G\ge \max \{5,\xi (G)\}. \end{aligned}$$

As we saw in Fig. 1, there are graphs G for which \(\mathrm {depth}\, S/J_G=\xi (G)>5\). There are also graphs G for which \(\mathrm {depth}\, S/J_G=5\), while \(\xi (G)<5\). For instance, let G be the graph shown in Fig. 4. We have \(\xi (G)=2\). However, we will see in Theorem 5 that \(\mathrm {depth}\, S/J_G=5\). Our main goal in the rest of this paper is to characterize all graphs G with \(\mathrm {depth}\, S/J_G=5\).

4 A poset associated with binomial edge ideals and a Hochster-type formula

In this section, continuing the topological approach from [1] and [23], we study the local cohomology modules of binomial edge ideals. To this end, we first associate a new poset, adapted to our needs, with binomial edge ideals as follows.

Let I be an ideal in the polynomial ring S and \(I=q_1\cap \cdots \cap q_t\) be an arbitrary decomposition for the ideal I. Then, by the poset \(\mathscr {R}_I\), ordered by the reverse inclusion, we mean the poset of all possible sums of ideals in this decomposition, defined in [2, Example 2.1]. Now, we know that \(J_{G}=\bigcap \limits _{\begin{array}{c} T\subseteq [n] \end{array}}P_T(G)\). We use \(\mathscr {R}_{G}\), instead of \(\mathscr {R}_{J_G}\), to denote the poset arose from the above decomposition of \(J_G\).

Now, we define another poset associated with the binomial edge ideal of a graph G.

Definition 2

Let G be a graph on [n]. Associated with the decomposition \(J_{G}=\bigcap \limits _{\begin{array}{c} T\subseteq [n] \end{array}}P_T(G)\), we consider the poset \((\mathscr {M}_G,\preccurlyeq )\), ordered by reverse inclusion, which is made up of the following elements:

  • the prime ideals in the poset \(\mathscr {R}_{G}\),

  • the prime ideals in the posets \(\mathscr {R}_{I}\), arising from the following type of decompositions:

    $$\begin{aligned} I=q_1\cap q_2 \cap \cdots \cap q_t \cap \left( q_1+P_\emptyset (G)\right) \cap \left( q_2+P_\emptyset (G)\right) \cap \cdots \cap \left( q_t+P_\emptyset (G)\right) , \end{aligned}$$

    where I’s are the non-prime ideals in the poset \(\mathscr {R}_{G}\) and \(q_1, q_2,\ldots , q_t\) are the minimal prime ideals of I, and

  • the prime ideals that we obtain repeatedly by this procedure every time that we find a non-prime ideal.

Note that using the non-minimal primary decomposition \(J_{G}=\bigcap \limits _{\begin{array}{c} T\subseteq [n] \end{array}}P_T(G)\) in Definition 2 turns the poset \(\mathscr {M}_G\) to be different from the posets \(\mathscr {A}_G\) and \(\mathscr {Q}_G\), considered by the authors in [1] and [23], respectively. We also notice that the significance of this new definition will be demonstrated in the proof of Theorem  5 and Theorem 6. Furthermore, the following lemma, which is a direct consequence of [23, Proposition 3.4], guarantees that the process of the construction of the poset \(\mathscr {M}_G\) terminates after a finite number of steps just like the construction process of the poset \(\mathscr {A}_{G}\) as well as the poset \(\mathscr {Q}_G\).

Lemma 2

Let G be a graph on [n]. Then, every element q of the poset \(\mathscr {M}_G\) is of the form \(P_T(H)\), for some graph H on [n] and some \(T\subseteq [n]\).

Now, by applying Lemma 2 and thanks to the flexibility for the decomposition of the ideals in [2, Theorem 5.22], the following Hochster-type decomposition formula for the local cohomology modules of binomial edge ideals is established by using the same argument that was applied in the proof of [1, Theorem 3.9]. We first need to fix a notation before stating the formula.

Let \(1_{{\mathscr {M}_G}}\) be a terminal element that we add to the poset \(\mathscr {M}_G\). Then, recall that for every \(q\in \mathscr {M}_G\), by the interval \((q,1_{\mathscr {M}_G})\), one means the subposet

$$\begin{aligned} \left\{ z\in \mathscr {M}_G: q\precneqq z\precneqq 1_{{\mathscr {M}_G}}\right\} . \end{aligned}$$

Theorem 4

(see [1, Theorem 3.9] and [23, Theorem 3.6].) Let G be a graph on [n]. Then, we have the \(\mathbb {K}\)-isomorphism

$$\begin{aligned} H_{\mathfrak {m}}^{i}(S/J_G)\cong \bigoplus _{q \in \mathscr {M}_G} H_{\mathfrak {m}}^{d_q}(S/q)^{\oplus M_{i,q}}, \end{aligned}$$

where \(d_q=\dim S/q\) and \(M_{i,q}=\dim _{\mathbb {K}} \widetilde{H}^{i-d_q-1}((q,1_{{\mathscr {M}_G}});\mathbb {K})\).

Note that the above theorem suggests an interesting and also a wonderful method to study the depth of binomial edge ideals. Indeed, instead of working directly with the minimal graded free resolution of \(S/J_G\), which is almost an intractable task, we may elaborate the topological properties of the subposets \((q,1_{{\mathscr {M}_G}})\) of \(\mathscr {M}_G\). In this approach, beside the algebraic tools, we also employ the topological tools.

5 Combinatorial characterization of some binomial edge ideals in terms of their depth

At the end of Sect. 3, we provided a lower bound for the depth of binomial edge ideals. We showed that for a graph G with more than three vertices, \(\mathrm {depth}\, S/J_G\ge \max \{5,\xi (G)\}\), if \(G\ne G'*2K_1\) for every graph \(G'\). Now, our main goal in this section is to give a combinatorial characterization of graphs G with \(\mathrm {depth}\, S/J_G=5\). For this aim, we need to study topological properties of certain subposets of \(\mathscr {M}_G\) to compute some local cohomology modules of \(S/J_G\).

First, we need to state the following definition.

Definition 3

Let \(T\subseteq [n]\) with \(|T|=n-2\). Associated with T, we introduce a family of graphs on [n], denoted by \(\mathscr {G}_T\), such that for each \(G\in \mathscr {G}_T\), there exist two non-adjacent vertices u and w of G with \(u,w\in [n]\backslash T\), and three disjoint subsets of T, say \(V_0\), \(V_1\) and \(V_2\) with \(V_1,V_2\ne \emptyset \) and \(\bigcup _{i=0}^{2}V_i=T\), such that the following conditions hold:

  1. (1)

    \(N_G(u)=V_0\cup V_1\) and \(N_G(w)=V_0\cup V_2\).

  2. (2)

    \(\{v_1,v_2\}\in E(G)\), for every \(v_1\in V_1\) and every \(v_2\in V_2\).

Remark 1

Given three arbitrary graphs \(G_0\), \(G_1\) and \(G_2\) on disjoint sets of vertices \(V_0\), \(V_1\) and \(V_2\), respectively, where \(V_1,V_2\ne \emptyset \), we can construct a graph in the family \(\mathscr {G}_T\) with \(T=\bigcup _{i=0}^{2}V_i\). Note that the vertices in \(V_0\) can be adjacent to some vertices in \(V_1\) and \(V_2\).

An explicit example of a graph G for which \(G\in \mathscr {G}_T\) for some \(T\subseteq V(G)\) with \(|T|=|V(G)|-2\) is depicted in Fig. 4.

Before stating the main theorem of this section, we need to introduce a family of graphs that is essential in our characterization. In the following, \(3K_1\) denotes the graph consisting of three isolated vertices.

Definition 4

Let G be a graph on [n] with \(G\ne G'*2K_1\) for any graph \(G'\). We say that G is a \(D_5\)-type graph, if one of the following conditions holds:

  1. (1)

    \(G\in \mathscr {G}_T\) for some \(T\subseteq [n]\);

  2. (2)

    \(G=H*3K_1\), for some graph H;

  3. (3)

    \(G=H*(K_1\dot{\cup }K_2)\), for some graph H.

Now, we are ready to state the main result of this section which is an explicit characterization of graphs G with \(\mathrm {depth}\, S/J_G=5\).

Theorem 5

Let G be a graph on [n] with \(n\ge 5\). Then, the following statements are equivalent:

  1. (a)

    \(\mathrm {depth}\, S/J_G=5\).

  2. (b)

    G is a \(D_5\)-type graph.

To prove the above theorem, we need to prepare several auxiliary ingredients. First, we state the following lemma that follows with the same argument as in the proof of [23, Lemma 4.1].

Lemma 3

Let G be a graph on [n]. Then, \(q+P_\emptyset (G)\in \mathscr {M}_G\), for every \(q\in \mathscr {M}_G\).

We also need to recall a concept from the literature of topology of posets.

Definition 5

A poset \(\mathscr {P}\) is said to be meet-contractible if there exists an element \(\alpha \in \mathscr {P}\) such that \(\alpha \) has a meet with every element \(\beta \in \mathscr {P}\).

The following lemma clarifies the importance of the notion of meet-contractible posets.

Lemma 4

([4, Theorem 3.2], see also [29, Proposition 2.4]) Every meet-contractible poset is contractible.

In the following theorem that is crucial in the proof of Theorem 5, we discuss the vanishing of the zeroth and the first reduced cohomology groups of the subposets associated with the elements of \(\mathscr {M}_G\), which are of the form \(P_T(H)\) for some graph H on [n] and some \(T\subseteq [n]\) with \(|T|=n-2\).

Theorem 6

Let G be a graph on [n] and \(q\in \mathscr {M}_G\), where \(q=P_{T}(H)\) for some graph H on [n] and some \(T\subseteq [n]\) with \(|T|=n-2\).

  1. (a)

    If \(c_H(T)=2\), then \((q,1_{\mathscr {M}_G})\) is connected if and only if \(G\notin \mathscr {G}_T\).

  2. (b)

    If \(c_H(T)=1\), then \(\widetilde{H}^{1}((q,1_{{\mathscr {M}_G}});\mathbb {K})=0\) if and only if \(G\notin \mathscr {G}_{T}\).

Proof

Without loss of generality, we assume that \(T=\{1,\ldots ,n-2\}\).

(a) We have \(q=(x_1,\ldots ,x_{n-2},y_1,\ldots ,y_{n-2})\), since \(c_H(T)=2\). Also, \(\{n-1,n\}\notin E(G)\). Indeed, assume on contrary that \(\{n-1,n\}\in E(G)\). Since \(q\in \mathscr {M}_G\), there exists \(U\in \mathscr {C}(G)\) such that \(P_U(G)\subseteq q\). It follows that \(U\subseteq T\). On the other hand, \(n-1\) and n are two adjacent vertices of \(G-U\). So, we get \(f_{n-1,n}\in P_U(G)\subseteq q\), a contradiction.

Now, assume that \(G\notin \mathscr {G}_T\). We show that \((q,1_{\mathscr {M}_G})\) is a connected poset. We proceed in the following steps:

Let \(L_0=N_G(n-1)\cap N_G(n)\), \(L_1=N_G(n)\backslash N_G(n-1)\), and \(L_2=N_G(n-1)\backslash N_G(n)\). We also let \(L_3=\{i\in T: i\notin N_G(n-1)\cup N_G(n)\}\). Set \(X=\{P_{T\setminus \{\alpha \}}(G): \alpha \in L_1 \cup L_2 \cup L_3\}\). One has \(X\subseteq (q,1_{\mathscr {M}_G})\), since \(\{n-1,n\}\notin E(G)\) and \(\alpha \notin L_0\) for every \(\alpha \in L_1\cup L_2\cup L_3\).

Step 1: Let \(q'\in (q,1_{\mathscr {M}_G})\). We claim that there exists \(P_{T\setminus \{\alpha \}}(G)\in X\) such that there is a path between \(q'\) and \(P_{T\setminus \{\alpha \}}(G)\) in the 1-skeleton graph of \((q,1_{\mathscr {M}_G})\).

By Lemma 2, we have that \(q'=P_{T'}(H')\), for some graph \(H'\) on [n] and some \(T'\subseteq [n]\). Now, there exists \(U\in \mathscr {C}(G)\) such that \(P_U(G)\subseteq q'\). It follows that \(U\subseteq T'\subsetneq T\), since \(q'\in (q,1_{\mathscr {M}_G})\). Now, we consider the following cases:

First, assume that \(T\setminus U\subseteq L_3\). Therefore, the vertices \(n-1\) and n are isolated in \(G-U\). This implies that \(P_U(G)\subseteq P_{T\setminus \{\alpha \}}(G)\), for every \(\alpha \in T\setminus U\).

Next, assume that \(T\setminus U\nsubseteq L_3\). Let \(\alpha \in (T\setminus U)\setminus L_3\). Clearly, \(\alpha \notin L_0\). Indeed, otherwise we get \(f_{n-1,n}\in P_U(G)\), a contradiction. So, without loss of generality we assume that \(\alpha \in L_1\). It follows that there is no path between vertices \(\alpha \) and \(n-1\) in \(G-U\). Therefore, we have that \(P_U(G)\subseteq P_{T\setminus \{\alpha \}}(G)\).

Thus, the claim follows from both above cases.

Step 2: Assume that \(L_3\ne \emptyset \). Let \(\alpha \in L_3\) and \(q'\in (q,1_{\mathscr {M}_G})\). We show that there exists a path between \(q'\) and \(P_{T\setminus \{\alpha \}}(G)\) in the 1-skeleton graph of \((q,1_{\mathscr {M}_G})\).

By Step 1, there exists \(P_{T\setminus \{\beta \}}(G)\in X\) such that there is a path between \(q'\) and \(P_{T\setminus \{\beta \}}(G)\) in the 1-skeleton graph of \((q,1_{\mathscr {M}_G})\). Moreover, since \(\alpha \in L_3\), it is not difficult to see that \(P_{T\setminus \{\alpha \}}(G)+P_{T\setminus \{\alpha ,\beta \}}(G)\in (q,1_{\mathscr {M}_G})\) and \(P_{T\setminus \{\beta \}}(G)\supseteq P_{T\setminus \{\alpha ,\beta \}}(G)\). Therefore, we have the path

$$\begin{aligned} P_{T\setminus \{\alpha \}}(G),P_{T\setminus \{\alpha \}}(G)+P_{T\setminus \{\alpha ,\beta \}}(G),P_{T\setminus \{\alpha ,\beta \}}(G),P_{T\setminus \{\beta \}}(G), \end{aligned}$$

in the 1-skeleton graph of \((q,1_{\mathscr {M}_G})\). This implies that \((q,1_{\mathscr {M}_G})\) is connected. So, for the rest of the proof we may assume that \(L_3=\emptyset \).

Step 3: Now, assume that \(\alpha ,\beta \in L_1\), and \(\alpha <\beta \). We claim that there exists a path in the 1-skeleton graph of \((q,1_{\mathscr {M}_G})\) between \(P_{T\setminus \{\alpha \}}(G)\) and \(P_{T\setminus \{\beta \}}(G)\). (The situation in the case \(\alpha ,\beta \in L_2\) is similar.)

We have that

$$\begin{aligned} P_{T\setminus \{\alpha \}}(G)=\left( x_i,y_i: i\in T\setminus \{\alpha \}\right) +\left( f_{\alpha ,n}\right) , \end{aligned}$$

and

$$\begin{aligned} P_{T\setminus \{\beta \}}(G)=\left( x_i,y_i: i\in T\setminus \{\beta \}\right) +\left( f_{\beta ,n}\right) . \end{aligned}$$

So, we get

$$\begin{aligned} P_{T\setminus \{\alpha ,\beta \}}(G)=(x_i,y_i: i\in T\setminus \{\alpha ,\beta \})+(f_{\alpha ,n},f_{\beta ,n},f_{\alpha ,\beta }). \end{aligned}$$

Therefore, we get the path

$$\begin{aligned} P_{T\setminus \{\alpha \}}(G),P_{T\setminus \{\alpha ,\beta \}}(G),P_{T\setminus \{\beta \}}(G) \end{aligned}$$

in the 1-skeleton graph of \((q,1_{\mathscr {M}_G})\), as desired.

Step 4: Let \(\alpha \in L_1\) and \(\beta \in L_2\). We show that there exists a path in the 1-skeleton graph of \((q,1_{\mathscr {M}_G})\) between the vertices \(P_{T\setminus \{\alpha \}}(G)\) and \(P_{T\setminus \{\beta \}}(G)\).

First, assume that \(\{\alpha ,\beta \}\notin E(G)\). It follows that

$$\begin{aligned} P_{T\setminus \{\alpha ,\beta \}}(G)=\left( x_i,y_i: i\in T\setminus \{\alpha ,\beta \}\right) +\left( f_{\beta ,n-1},f_{\alpha ,n}\right) . \end{aligned}$$

Therefore, we get the path

$$\begin{aligned} P_{T\setminus \{\alpha \}}(G),P_{T\setminus \{\alpha ,\beta \}}(G),P_{T\setminus \{\beta \}}(G), \end{aligned}$$

as desired.

Next, assume that \(\{\alpha ,\beta \}\in E(G)\). Now, there exist vertices \(t_1\in L_1\) and \(t_2\in L_2\), such that \(\{t_1,t_2\}\notin E(G)\). Indeed, if no such vertices exist, then by putting \(u=n\) and \(w=n-1\) and also \(V_0=L_0,V_1=L_1\) and \(V_2=L_2\) in Definition 3, we get \(G\in \mathscr {G}_T\), since \(\{n-1,n\}\notin E(G)\) and \(L_3=\emptyset \). Therefore, we get a contradiction. Now, by Step 3, there is a path between \(P_{T\setminus \{\alpha \}}(G)\) and \(P_{T\setminus \{t_1\}}(G)\), and also a path between \(P_{T\setminus \{\beta \}}(G)\) and \(P_{T\setminus \{t_2\}}(G)\), in the underlying graph of \((q,1_{\mathscr {M}_G})\). On the other hand, since \(\{t_1,t_2\}\notin E(G)\), the argument that we used in the first part of this step yields a path between \(P_{T\setminus \{t_1\}}(G)\) and \(P_{T\setminus \{t_2\}}(G)\). Therefore, we get a path between \(P_{T\setminus \{\alpha \}}(G)\) and \(P_{T\setminus \{\beta \}}(G)\) in the 1-skeleton graph of \((q,1_{\mathscr {M}_G})\), as desired.

Step 5: Now, suppose that \(q_{1}, q_{2}\in (q,1_{\mathscr {M}_G})\) and \(q_1\ne q_2\). Then, by Step 1, there exist \(P_{T\setminus \{\alpha \}}(G),P_{T\setminus \{\beta \}}(G)\in X\) such that there is a path between \(q_1\) and \(P_{T\setminus \{\alpha \}}(G)\), and a path between \(q_2\) and \(P_{T\setminus \{\beta \}}(G)\) in the 1-skeleton graph of \((q,1_{\mathscr {M}_G})\). Moreover, we have a path between \(P_{T\setminus \{\alpha \}}(G)\) and \(P_{T\setminus \{\beta \}}(G)\), by Steps 3 and 4. Therefore, we get a path between \(q_1\) and \(q_2\) in the 1-skeleton graph of \((q,1_{\mathscr {M}_G})\). Thus, \((q,1_{\mathscr {M}_G})\) is connected.

For the converse, assume that \(G\in \mathscr {G}_T\). Therefore, there exist three disjoint subsets \(V_0\), \(V_1\) and \(V_2\) of T, such that the conditions of Definition 3 hold. Now, let \(q_1=P_{V_0\cup V_1}(G)\), and \(q_2=P_{V_0\cup V_2}(G)\). We have that \(q_1,q_2\in (q,1_{\mathscr {M}_G})\). Now, we claim that there is no path between \(q_1\) and \(q_2\) in the 1-skeleton graph of \((q,1_{\mathscr {M}_G})\), and then, we conclude the result.

Notice that \(\{V_0\cup V_1,V_0\cup V_2\}\subseteq \mathscr {C}(G)\). Moreover, we have \(T'\in \{V_0\cup V_1,V_0\cup V_2\}\), for every \(T'\in \mathscr {C}(G)\) such that \(n-1\notin T'\) and \(n\notin T'\). Indeed, one could see that \(T'\supseteq V_0\cup V_1\) or \(T'\supseteq V_0\cup V_2\), for every \(T'\in \mathscr {C}(G)\) such that \(n-1\notin T'\) and \(n\notin T'\). Without loss of generality, we can assume that \(T'\supseteq V_0\cup V_1\). Now, we claim that \(T'= V_0\cup V_1\). Assume on contrary that there exists \(v_2\in T'\cap V_2\). This implies that \(v_2\) is not a cut vertex of \(G-(T'\setminus \{v_2\})\), a contradiction to the fact that \(T'\in \mathscr {C}(G)\). Therefore, we have either \(q'\supseteq q_1\) or \(q'\supseteq q_2\), for every \(q'\in (q,1_{\mathscr {M}_G})\). Now, assume on contrary that there exists a path \(\ell :q_1,q'_1,\ldots ,q'_t,q_2\), between \(q_1\) and \(q_2\) in the 1-skeleton graph of \((q,1_{\mathscr {M}_G})\). Moreover, we may assume that \(\ell \) is an induced path between the vertices \(q_1\) and \(q_2\). Now, we have that \(t\ge 2\). Indeed, \(t=1\) implies that \(q'_1\supseteq q_1\) and \(q'_1\supseteq q_2\), and hence, \(q'_1=q\), a contradiction.

Now, if \(q'_1\subseteq q'_2\), then \(q'_2\supseteq q_1\). This clearly contradicts the minimality of the path \(\ell \). So, we have \(q'_1\supseteq q'_2\). On the other hand, we have \(q'_2\supseteq q_2\), since \(q'_2\nsupseteq q_1\). Therefore, \(q'_1\supseteq q_2\), a contradiction to the minimality of \(\ell \).

So, there is no path between two vertices \(q_1\) and \(q_2\) in the 1-skeleton graph of \((q,1_{\mathscr {M}_G})\), as desired.

(b) Clearly, we have \(q=(x_1,\ldots ,x_{n-2},y_1,\ldots ,y_{n-2})+(f_{n-1,n})\), since \(c_H(T)=1\). Let \(q'=(x_1,\ldots ,x_{n-2},y_1,\ldots ,y_{n-2})\).

First, assume that \(G\notin \mathscr {G}_T\). We show that \(\widetilde{H}^{1}((q,1_{{\mathscr {M}_G}});\mathbb {K})=0\). We consider the following cases:

Case 1: Assume that \(q'\notin (q,1_{\mathscr {M}_G})\). We claim that \((q,1_{\mathscr {M}_G})\) is a meet-contractible poset. Then, the result follows by Lemma 4.

Clearly, \(P_\emptyset (G)\in (q,1_{\mathscr {M}_G})\). Now, let \(q_1\in (q,1_{\mathscr {M}_G})\) such that \(q_1\ne P_\emptyset (G)\). By Lemma 2, we have that \(q_1=P_{T_1}(H_1)\), for some graph \(H_1\) on [n] and some \(T_1\subseteq [n]\). Also, we have that \(T_1\subsetneqq T\), since \(q'\notin (q,1_{\mathscr {M}_G})\). Therefore, \(q_1+P_\emptyset (G)\in (q,1_{\mathscr {M}_G})\), by Lemma 3. Moreover, it is observed that \(q_1+P_\emptyset (G)\) is the meet of the elements \(q_1\) and \(P_\emptyset (G)\). Therefore, \((q,1_{\mathscr {M}_G})\) is a meet-contractible poset, as desired.

Case 2: Assume that \(q'\in (q,1_{\mathscr {M}_G})\). Let \(\Delta =\Delta (q,1_{\mathscr {M}_G})\), \(\Delta _1=\mathrm {star}_{\Delta }(q')\) and \(\Delta _2=\mathrm {del}_{\Delta }(q')\). One has \(\mathrm {del}_{\Delta }(q')=\Delta ((q,1_{\mathscr {M}_G})\setminus \{q'\})\). Then, by a similar argument as in Case 1, it follows that \(\Delta _2\) is a contractible simplicial complex. On the other hand, \(\Delta _1\cap \Delta _2=\mathrm {link}_\Delta (q')=\Delta (q',1_{\mathscr {M}_G})\), since \(q'\) is a minimal element in the poset \((q,1_{\mathscr {M}_G})\).

Now, first assume that \(\Delta _1\cap \Delta _2=\{\emptyset \}\). So, clearly we have \({H}_{0}(\mathrm {link}_{\Delta }(q');\mathbb {K})=0\). Now, since \(\Delta _1\) is a cone and \(\Delta _2\) is contractible, the Mayer–Vietoris sequence

$$\begin{aligned}&\cdots \rightarrow H_1\left( \mathrm {star}_{\Delta }(q');\mathbb {K}\right) \oplus H_1\left( \mathrm {del}_{\Delta }(q');\mathbb {K}\right) \rightarrow H_1(\Delta ;\mathbb {K})\rightarrow \\&\quad H_{0}\left( \mathrm {link}_{\Delta }(q');\mathbb {K}\right) \rightarrow \cdots \end{aligned}$$

implies the result.

Next, assume that \(\Delta _1\cap \Delta _2\ne \{\emptyset \}\). Hence, the reduced Mayer–Vietoris sequence

$$\begin{aligned}&\cdots \rightarrow \widetilde{H}_1\left( \mathrm {star}_{\Delta }(q');\mathbb {K}\right) \oplus \widetilde{H}_1\left( \mathrm {del}_{\Delta }(q');\mathbb {K}\right) \rightarrow \widetilde{H}_1(\Delta ;\mathbb {K})\\&\quad \rightarrow \widetilde{H}_{0}\left( \mathrm {link}_{\Delta }(q');\mathbb {K}\right) \rightarrow \cdots \end{aligned}$$

is induced. On the other hand, \(q'\in \mathscr {M}_G\). Thus, by Lemma 2, we have \(q'=P_{T'}(H')\), for some graph \(H'\) on [n] and some \(T'\subseteq [n]\). Now, it is easily seen that \(T'=T\). Also, \(c_{H'}(T')=2\), since otherwise we get \(q'=q\), a contradiction. Therefore, since \(G\notin \mathscr {G}_T\), by part (a) we have \(\widetilde{H}_{0}(\mathrm {link}_{\Delta }(q');\mathbb {K})=\widetilde{H}_{0}(\Delta (q',1_{\mathscr {M}_G});\mathbb {K})=0\), and hence, by using the latter Mayer–Vietoris sequence we get the result.

Now, for the converse, assume that \(G\in \mathscr {G}_T\). We show that \(\widetilde{H}^{1}((q,1_{{\mathscr {M}_G}});\mathbb {K})\ne 0\). It is clear by Definition 3 that \(q'=P_T(G)\), and hence, \(q'\in (q,1_{\mathscr {M}_G})\). Moreover, Definition 3 again implies that \((q',1_{\mathscr {M}_G})\) is a non-empty poset. Indeed, by the notation of Definition 3 we have \(P_{V_0\cup V_1}(G),P_{V_0\cup V_2}(G)\in (q',1_{\mathscr {M}_G})\). Now, by keeping the same notation and also by the same argument as in Case 2 in above, the exact sequence

$$\begin{aligned} 0 \rightarrow \widetilde{H}_1(\Delta ;\mathbb {K})\rightarrow \widetilde{H}_{0}(\mathrm {link}_{\Delta }(q');\mathbb {K})\rightarrow 0 \end{aligned}$$

is induced. On the other hand, we have \(c_G(T)=2\), by Definition 3. Therefore, since \(G\in \mathscr {G}_T\), part (a) implies that \(\widetilde{H}_{0}(\mathrm {link}_{\Delta }(q');\mathbb {K})\ne 0\), and hence, the result follows. \(\square \)

Now, we state the following lemma which is used in the proof of Theorem 5.

Lemma 5

Let G be a graph on [n] with \(n\ge 4\). If there exists \(T'\in \mathscr {C}(G)\) with \(|T'|=n-3\) and \(c_G(T')=2\), then either \(G\in \mathscr {G}_{T}\) for some \(T\subseteq [n]\), or \(G=H*(K_1\dot{\cup }K_2)\) for some graph H on \(n-3\) vertices.

Proof

Without loss of generality assume that \(T'=\{1,\ldots ,n-3\}\). We may also assume that n is the isolated vertex of \(G-T'\), since \(c_G(T')=2\). Therefore, for every \(i\in T'\) we have \(i\in N_G(n)\), and either \(i\in N_G(n-1)\) or \(i\in N_G(n-2)\), since \(T'\in \mathscr {C}(G)\). Now, suppose that \(G\ne H*(K_1\dot{\cup }K_2)\), for every graph H on \(n-3\) vertices. We show that \(G\in \mathscr {G}_{T}\) for some \(T\subseteq [n]\).

Clearly, there exists \(j\in \{n-2,n-1\}\) such that \(T'\nsubseteq N_G(j)\). Let \(V_0=N_G(j)\cap T', V_1=T'\setminus N_G(j)\) and \(V_2=N_G(j)\setminus T'\). Now, by putting \(u=n\) and \(w=j\) in Definition 3, one checks that \(G\in \mathscr {G}_T\), where \(T=[n]\setminus \{n,j\}\). \(\square \)

Finally, we need to state the following remark that will be used in the proof of Theorem 5. The proof of this remark can be verified by taking a precise look at the proof of [23, Theorem 4.4].

Remark 2

Let G be a graph on [n] with \(n\ge 2\). Let \(\widehat{\mathfrak {m}}=P_T(H)\), where H is a graph on [n] with \(|T|=n-1\). Then, the posets \((\mathfrak {m},1_{\mathscr {M}_G})\) and \((\widehat{\mathfrak {m}},1_{\mathscr {M}_G})\) are contractible.

Now, we are ready to prove the main theorem of this section.

Proof of Theorem 5:

\((a)\Rightarrow (b)\) Assume that G is not a \(D_5\)-type graph. We show \(\mathrm {depth}\, S/J_G\ne 5\). Notice that if \(G=G'*2K_1\) for some graph \(G'\), then \(\mathrm {depth}\, S/J_G=4\), by [23, Theorem 5.3]. So, we may assume that \(G\ne G'*2K_1\), for any graph \(G'\). Now, by the definition of depth and by Theorem 4, it is enough to show that \(M_{5,q}=\dim _{\mathbb {K}} \widetilde{H}^{4-d_q}((q,1_{{\mathscr {M}_G}});\mathbb {K})=0\), for all \(q\in \mathscr {M}_G\).

Let q be an arbitrary element of the poset \(\mathscr {M}_G\). We have \(q=P_{T}(H)\) for some graph H on [n] and some \(T\subseteq [n]\), by Lemma 2. If \(d_q\ge 6\), then obviously we have the result. Moreover, it is easily seen that there is no \(q'\in \mathscr {M}_G\) such that \(d_{q'}=1\). Therefore, we assume that \(d_q\in \{0,2,3,4,5\}\). Now, we consider the following cases:

Let \(d_q\in \{0,2\}\). So, \(\mathrm {ht}q\in \{2n-2,2n\}\). This implies that \(|T|-c_H(T)\in \{n-2,n\}\). Therefore, without loss of generality, we assume that either \(q=\mathfrak {m}\) or \(q=\widehat{\mathfrak {m}}\). Now, the result follows, since the posets \((\mathfrak {m},1_{{\mathscr {M}_G}})\) and \((\widehat{\mathfrak {m}},1_{{\mathscr {M}_G}})\) are contractible by Remark 2.

Let \(d_q=3\). Then, \(|T|-c_H(T)=n-3\), and hence, \(|T|=n-2\) and \(c_H(T)=1\). Now, by Definition 4, \(G\notin \mathscr {G}_T\), since G is not a \(D_5\)-type graph. Thus, we have \(M_{5,q}=\dim _{\mathbb {K}}\widetilde{H}^{1}((q,1_{{\mathscr {M}_G}});\mathbb {K})=0\), by Theorem 6 part (b).

Let \(d_q=4\). It follows that \(|T|-c_H(T)=n-4\). So, we have either \(|T|=n-2\) and \(c_H(T)=2\), or \(|T|=n-3\) and \(c_H(T)=1\).

First, assume that \(|T|=n-2\) and \(c_H(T)=2\). Therefore, Theorem 6 part (a) implies that \(M_{5,q}=\dim _{\mathbb {K}} \widetilde{H}^{0}((q,1_{{\mathscr {M}_G}});\mathbb {K})=0\), since \(G\notin \mathscr {G}_T\).

Next, assume that \(|T|=n-3\) and \(c_H(T)=1\). Without loss of generality, we assume that \(T=\{1,\ldots ,n-3\}\). Therefore,

$$\begin{aligned} q=\left( x_1,\ldots ,x_{n-3},y_1,\ldots ,y_{n-3}\right) +\left( f_{n-2,n-1},f_{n-2,n},f_{n-1,n}\right) . \end{aligned}$$

Let \(q_{1}, q_{2}\in (q,1_{\mathscr {M}_G})\) and \(q_1\ne q_2\). Then, there exist \(T_1,T_2\in \mathscr {C}(G)\) such that \(q_1\supseteq P_{T_1}(G)\) and \(q_2\supseteq P_{T_2}(G)\). Moreover, we have \(T_1,T_2\subseteq T\), since \(q_{1}, q_{2}\in (q,1_{\mathscr {M}_G})\). Now, we distinguish the following cases:

First, assume that \(T_1,T_2\subsetneqq T\). Therefore, by Lemma 3, we have that \(q_{1}+P_{\emptyset }(G)\in (q,1_{\mathscr {M}_G})\) and \(q_{2}+P_{\emptyset }(G)\in (q,1_{\mathscr {M}_G})\), since \(q_{1}+P_{\emptyset }(G)\subsetneqq q\) and \(q_{2}+P_{\emptyset }(G)\subsetneqq q\). So, we get the path

$$\begin{aligned} q_{1}, P_{T_1}(G), P_{T_1}(G)+P_{\emptyset }(G), P_{\emptyset }(G), P_{\emptyset }(G)+P_{T_2}(G), P_{T_2}(G), q_{2} \end{aligned}$$

in the 1-skeleton graph of the order complex of the poset \((q,1_{\mathscr {M}_G})\).

Next, assume that \(T_1=T\) or \(T_2=T\). If \(T_1=T_2\), then we get the path \(q_1,P_{T_1}(G)=P_{T_2}(G),q_2\), as desired. So, without loss of generality, we assume that \(T_1=T\) and \(T_2\subsetneqq T\). One has \(c_G(T_1)\in \{2,3\}\), since \(T_1\in \mathscr {C}(G)\). Notice that if \(c_G(T_1)=2\), then Lemma 5 implies that G is a \(D_5\)-type graph, a contradiction. So, we have \(c_G(T_1)=3\). Furthermore, there exist two vertices \(\alpha \in T_1\) and \(\beta \in \{n-2,n-1,n\}\), such that \(\{\alpha ,\beta \}\notin E(G)\). Indeed, otherwise we get \(G=H*3K_1\), where \(H=G-\{n-2,n-1,n\}\), which is a contradiction with Definition 4. Now, one could see that

$$\begin{aligned} P_{T_1}(G)+P_{{T_1}\setminus \{\alpha \}}(G)=(x_1,\ldots ,x_{n-3},y_1,\ldots ,y_{n-3})+(f_{i,j}), \end{aligned}$$

where \(i<j\) and \(i,j \in \{n-2,n-1,n\}\setminus \{\beta \}\). Therefore, we have that \(P_{T_1}(G)+P_{{T_1}\setminus \{\alpha \}}(G)\in (q,1_{\mathscr {M}_G})\). So, we get the path

figure a

between \(q_1\) and \(q_2\) in the 1-skeleton graph of the order complex of the poset \((q,1_{\mathscr {M}_G})\).

Therefore, it follows from both cases that \((q,1_{\mathscr {M}_G})\) is connected, and hence, the desired result follows.

Let \(d_q=5\). It follows that \(|T|-c_H(T)=n-5\). So, we have that either \(|T|=n-3\) and \(c_H(T)=2\), or \(|T|=n-4\) and \(c_H(T)=1\). Now, the result follows once we show that \((q,1_{{\mathscr {M}_G}})\) is a non-empty poset.

First, suppose that \(|T|=n-3\) and \(c_H(T)=2\). Assume on contrary that \((q,1_{{\mathscr {M}_G}})\) is an empty poset, i.e., \(q\in \mathrm {Min}(J_G)\). Then, \(q=P_{T'}(G)\) for some \(T'\in \mathscr {C}(G)\). It follows that \(T'=T\) and \(c_G(T')=c_H(T)=2\). Therefore, Lemma 5 implies that G is a \(D_5\)-type graph, a contradiction.

Next, suppose that \(|T|=n-4\) and \(c_H(T)=1\). Therefore, we have \(P_{\emptyset }(G)\subseteq q\). Moreover, the assumption \(n\ge 5\) implies that \(T\ne \emptyset \), and hence, \(P_{\emptyset }(G)\in (q,1_{\mathscr {M}_G})\), as desired.

\((b)\Rightarrow (a)\) Assume that G is a \(D_5\)-type graph. Then, Corollary 2 implies that \(\mathrm {depth}\, S/J_G\ge 5\). Therefore, the result follows if we show that \(\mathrm {depth}\, S/J_G\le 5\). To do so, we consider the following cases:

First, assume that \(G\in \mathscr {G}_T\), for some \(T\subseteq [n]\) with \(|T|=n-2\). Let \(q=P_T(G)\). We have \(q\in \mathscr {M}_G\), and by Definition 3, we have \(c_{G}(T)=2\). Thus, Theorem 6 part (a) implies that \((q,1_{\mathscr {M}_G})\) is not connected. Since \(d_q=4\), we have that \(M_{5,q}=\dim _{\mathbb {K}} \widetilde{H}^{0}((q,1_{{\mathscr {M}_G}});\mathbb {K})\ne 0\). Therefore, we get \(H_{\mathfrak {m}}^{5}(S/J_G)\ne 0\), by Theorem  4. This yields that \(\mathrm {depth}\, S/J_G\le 5\), as desired.

Next, assume that \(G=H*3K_1\), for some graph H. If H is a complete graph, then the result follows by [19, Theorem 3.9]. If H is not complete, then it follows from [19, Theorem 4.3] and [19, Theorem 4.4] that \(\mathrm {depth}\, S/J_G=5\), as desired.

Finally, suppose that \(G=H*(K_1\dot{\cup }K_2)\), for some graph H. The result follows by [19, Theorem 3.9] if H is a complete graph. If H is not complete, then it follows from [19, Theorem 4.3] and [19, Theorem 4.4] that \(\mathrm {depth}\, S/J_G=5\), as desired. \(\square \)