1 Introduction

The hypercube \(Q_n\), where n is a natural number, is a graph on a vertex set \(\{A: A\subseteq [n]\}\) and an edge set consisting of all pairs \(\{A,B\}\), where \(A\subseteq B\) and \(|A|=|B|-1\). Here, \([n]= \{1, \ldots , n\}\). We often identify vertices of \(Q_n\) with binary vectors that are indicator vectors of respective sets. If a graph is a subgraph of \(Q_n\), for some n, it is called cubical. We denote the number of vertices and the number of edges in a graph H by |H| and ||H||, respectively.

For a graph H, let the extremal number of H in \(Q_n\), denoted \(\textrm{ex}(Q_n, H)\), be the largest number of edges in a subgraph G of \(Q_n\) such that there is no subgraph of G isomorphic to H. A graph H is said to have zero Turán density in the hypercube if \(\textrm{ex}(Q_n, H) = o(||Q_n||)\). Otherwise, we say that H has positive Turán density in the hypercube. Note that using a standard double counting argument, the sequence \(\textrm{ex}(Q_n, H)/||Q_n||\) is non-increasing, thus the above density notions are well-defined. When clear from context, we simply say Turán density instead of Turán density in a hypercube. The behavior of the function \(\textrm{ex}(Q_n, H)\) is not well understood in general and it is not even known what graphs have positive or zero Turán density. Currently, the only known cubical graphs of positive Turán density are those containing a 4- or a 6-cycle as a subgraph. Conlon [19] observed a connection between extremal numbers in the hypercube and classical extremal numbers for uniform hypergraphs. That permitted the determination of a large class of graphs with zero Turán density. For more results on extremal numbers in the hypercube, see [1, 2, 5, 8, 9, 42, 44].

Another class of graphs that are of particular importance as a superset of all graphs of zero Turán density corresponds to so-called layered graphs. The kth vertex layer, denoted \(V_k\), of \(Q_n\) is \(\left( {\begin{array}{c}[n]\\ k\end{array}}\right) \), the set of all vertices that are k-element subsets of [n]. The kth edge layer of \(Q_n\) is the subgraph of \(Q_n\) induced by the kth and \((k-1)\)st vertex layers. For other standard graph theoretic notions, we refer the reader to Diestel [21]. A cubical graph is called layered if it is a subgraph of some edge layer of \(Q_n\), for some n. Note for example, that \(C_4\) is not layered and \(C_{2\ell }\) is layered for any \(\ell \ge 3\). It is an easy observation that cubical graphs that are not layered have positive Turán density. Indeed, a subgraph of \(Q_n\) that is a union of its even (or odd) edge layers contains only layered connected graphs as subgraphs.

In this paper, we focus on layered graphs. First, we give a characterization of layered graphs in terms of edge-colorings. We say that an edge-coloring of a graph is nice if for any cycle, each color appears an even number of times and in any path with at least one edge there is a color that appears odd number of times. We say that an edge coloring of a graph G is very nice if it is nice and for any two edges of the same color, any path between them that has no edges of that color has an even length. We extend a result by Havel and Moravek [32] to layered graphs.

Theorem 1

A graph is layered if and only if it has a very nice edge-coloring.

Theorem 1 shows in particular that graphs with no very nice coloring have positive Turán density. A natural question to consider is whether there are sparse cubical graphs that have positive Turán density. We show that most subdivisions have zero Turán density, but there are graphs of girth at least eight that have positive Turán density. Let \(K_t\) and \(K_{t,t}\) be complete and balanced complete bipartite graphs on t and 2t vertices, respectively. For a graph G and a positive integer k, let \(T_k(G)\) be a k-subdivision of G, i.e., a graph obtained from G by subdividing each edge with k new vertices. Since an even subdivision of an odd cycle is an odd cycle, that is not cubical, we consider even subdivisions of bipartite graphs only.

Theorem 2

Let k and t be positive integers. Then \(T_{2k+1}(K_t)\) and \(T_{2k}(K_{t,t})\) are layered. Moreover, \(\textrm{ex}(Q_n, T_{2k+1}(K_t)) = O(n^b2^n)= o(||Q_n||)\), where \(b=1-(k+1)^{-1}t^{-k}\). If, in addition, \(k\ge 4\) is even, then \(\textrm{ex}(Q_n, T_{2k}(K_{t,t})) = O( n^{b'}2^n) = o(||Q_n||)\), where \(b'= 1 -(2t^3+4t)^{-1}k^{-t^2}\).

Theorem 3

There is a cubical graph of girth 8 that is not layered.

A lot of research was done on even cycles and their extremal numbers in a hypercube. Here, a \(2\ell \)-cycle is denoted \(C_{2\ell }\). The fact that \(\textrm{ex}(Q_n, C_4) = \Omega (||Q_n||)\) and \(\textrm{ex}(Q_n, C_6) = \Omega (||Q_n||)\) was shown by Chung [16], Conder [18], and Brass et al. [14]. Chung [16] showed that \(\textrm{ex}(Q_n, C_{4k})=o(||Q_n||)\), for any integer \(k\ge 2\). Füredi and Özkahya [26, 27] extended Chung’s results by showing that \(\textrm{ex}(Q_n, C_{4k+2})=o(||Q_n||)\), for any integer \(k\ge 3\). Thus \(C_{2\ell }\) has zero Turán density for \(\ell = 4\) and \(\ell \ge 6\). Considering more specific upper bounds for cycles with zero Turán density, Conlon [19] proved for \(k \ge 2\) that \(\textrm{ex}(Q_n, C_{4k}) \le c_k n^{-1/2 + 1/(2k)} ||Q_n||\). Improving on results of Füredi and Özkahya [26, 27], Axenovich [7] showed that for an odd integer \(\ell \ge 7\), \(\textrm{ex}(Q_n, C_{2\ell })= O\left( n^{5/6 + 1/(3(\ell -3))} 2^n\right) \). Tomon [45] independently proved a better upper bound for large \(\ell \): \(\textrm{ex}(Q_n, C_{2\ell })= O(n^{2/3+ \delta } 2^n), \) for some \(\delta = O((\log \ell ) /\ell )\).

It remains unknown whether \(C_{10}\) has zero or positive Turán density. While we still could not answer this question we improve on the known lower bounds of \(\textrm{ex}(Q_n, C_{10})\):

Theorem 4

\(\textrm{ex}(Q_n, C_{10}) = \Omega \left( \frac{n}{\log ^a n} 2^n\right) \), where \(a = \log _2 3\).

The rest of the paper is structured as follows. We prove Theorem 1 as an immediate corollary of Theorem 6 in Sect. 2. In Sect. 3, we address subdivisions and prove Theorems 10 and 11, that imply Theorem 2. Theorem 3 is proved in Sect. 4 and Theorem 4 is proved in Sect. 5. We give some density properties of layered graphs in Sect. 6. Section 7 contains concluding remarks and open questions. In Appendix A we present an alternative proof for an upper bound on extremal numbers for graphs of zero Turán density. In Appendix B we provide a symmetric layered embedding of a hypercube.

After this paper was accepted for publication, two of the questions from this paper were answered. First, it was shown by Grebennikov and Marciano [29] that \(C_{10}\) has positive Turán density in the hypercube using a construction for daisy-free hypergraphs by Ellis, Ivan, and Leader [22]. Second, Behague, Leader, Morrison, and Williams [10] showed that there is a cubical graph of arbitrarily high girth that is not layered.

2 Characterization of Layered Graphs in Terms of Very Nice Colorings, Proof of Theorem 1

Recall that an edge-coloring of a graph is nice if, for any cycle, each color appears an even number of times and in any path with at least one edge there is a color that appears an odd number of times. An edge-coloring of a graph G is very nice if it is nice and, for any two edges of the same color, any path between them that has no edges of that color has an even length.

Theorem 5

(Havel and Moravek [32]) A graph is cubical if and only if there is a nice edge-coloring of the graph.

Here, we extend this characterization to layered graphs. Recall that the distance between two edges in a connected graph is the length of a shortest path between some endpoint of one edge and some endpoint of the other edge. Similarly, the distance between a vertex v and a set of edges S is the smallest distance between v and an edge from S. For an edge of \(Q_n\), let its direction be the coordinate at which its endpoints differ. We shall also represent an edge AB, \(A\subseteq B\) in \(Q_n\) by a sequence of length n, where the ith position is occupied by 0 if \(i\notin B\), by 1 if \(i\in A\) and by \(\star \) if \(i\in B\setminus A\). We call this a star representation and refer to a position occupied by a \(\star \) as a star position, that in turn corresponds to the direction of the edge. A color class in an edge-coloring of a graph is a set of all edges having the same color. The following theorem immediately implies Theorem 1. The following theorem contains some additional properties of very nice colorings that are of independent interest.

Theorem 6

A graph is layered if and only if it has a very nice edge-coloring. Moreover, if a graph is embedded in a layer and its edges are assigned colors corresponding to directions of the edges, then this coloring is very nice. In addition, any color class in a very nice coloring of a connected graph is a cut.

Proof

One direction of the proof is easy. Consider a connected graph G with all edges in one layer of \(Q_n\). Let \(c: E(G)\rightarrow [n]\) be a coloring such that c(e) is equal to the direction of e. Then it is easy to see and was verified in [32], that c is nice. Consider two edges e and \(e'\) of the same color and a path between them not using that color. It is clear that the path must be of even length.

For the other direction, consider a graph G with a very nice coloring c. We can assume that it is connected. Fix a vertex v of G. Consider all color classes with even distance to v and let \(C^+\) be the set of colors on these color classes. Let \(C^-\) be the set of all other colors used on G. We shall consider an embedding f of G that puts an edge in a direction corresponding to its color. Assume that \([n]=C^+ \cup C^-\). Formally, let \(f: V(G) \rightarrow V(Q_n)\) be defined as follows. Let v be mapped to a vertex \(f(v)= C^-\) in the kth layer, \(V_k\), where \(k= |C^-|\). Assume that a vertex u has been mapped and \(u'\) is a neighbor of u. We define \(f(u')\) to be the vertex in \(Q_n\) such that f(u) and \(f(u')\) are adjacent and the direction of \(f(u)f(u')\) is equal to \(c(uu')\). I.e., either \(f(u)\setminus f(u')= c(uu')\) or \(f(u') {\setminus } f(u)= c(uu')\). Let \(G'\) be a graph resulted from this map, i.e., \(V(G') = \{f(u): u\in V(G)\}\), \(E(G') = \{f(u)f(u'): uu' \in E(G)\}\).

First of all, we have that the function f is indeed an injective map into \(Q_n\) preserving adjacencies exactly as shown in [32]. For completeness we repeat the argument here. The function f is well-defined since for any vu-path in G and any color, the number of edges of that color has the same parity among all such paths, since the coloring is nice. Indeed, otherwise in the union of two paths with different parity of the number of edges of say color j, we would find a cycle with an odd number of edges colored j. If \(f(u)=f(u')\) for distinct vertices u and \(u'\), consider a closed walk formed by taking a union of f(v), f(u)- and \(f(v),f(u')\)-paths in \(G'\). A smallest cycle \(C'\) in this walk containing f(u) corresponds to a \(u,u'\)-path \(P'\) in G. Let W be the multiset of colors used by c on \(P'\). By definition, W corresponds to the multiset of directions of the edges of \(C'\), so each direction in W appears an even number of times. However, the niceness of c implies that some color appears an odd number of times in W, a contradiction. So, the map is well-defined, injective, and it clearly preserves adjacencies.

Now, we shall show that f maps the vertex set of G into a subset of \(V_k \cup V_{k+1}\). Consider an arbitrary vertex u and a vu-path P. We claim by induction on the length of P that V(P) is mapped to a subset of \( V_k \cup V_{k+1}\). The basis for induction is trivial since \(f(v)\in V_k\). Let P have length at least one, let \(u'\) be the neighbor of u in P, and \(P'=P-u\). Then by induction \(V(P')\) is mapped onto a subset of \(V_k\cup V_{k+1}\). Let \(j=c(uu')\).

Let \(x_0\) be the number of edges between v and the first edge of color j on P, and let \(x_1\) be the number of edges of color j in \(P'\). Recall that the number of edges between consecutive edges of color j on any path is even. Thus we have that \(||P'||\) is even if and only if \(x_0 + x_1\) is even. Furthermore, recall that \(x_0\) is even if and only if \(j\in C^+\), or equivalently \(j\not \in f(v)\). This implies that \(j\not \in f(u')\) if and only if \(x_0+x_1\) is even. Therefore, if \(x_0 + x_1\) is even, we have that \(||P'||\) is even, thus \(f(u')\in V_k\) and additionally \(j\not \in f(u')\). Then by the rules of embedding \(f(u) = f(u') \cup \{j\} \in V_{k+1}\). If \(x_0+x_1\) is odd, then \(||P'||\) is odd, so \(f(u')\in V_{k+1}\), and \(j\in f(u')\). Then by the rules of embedding \(f(u) = f(u') -\{j\} \in V_{k}\).

To see that any color class in a very nice coloring of a connected graph G is a cut, assume the opposite, i.e., assume that removing the edges of some color, i, results in a connected graph \(G'\). Then, the endpoints of some edge e of color i are connected by a path in \(G'\). This path, together with the edge e is a cycle with color i represented on exactly one edge, thus contradicting the fact that the coloring is nice. \(\square \)

3 Subdivisions—Layered Embeddings and Extremal Numbers, Proof of Theorem 2

We shall need some preliminary definitions and known results to prove Theorem 2.

3.1 Partite Representations, Extremal Numbers for Hypergraphs, and Extremal Numbers in a Hypercube

We say that a subgraph H of \(Q_n\) has a k-partite representation \(\mathcal {H}\) if H is isomorphic to a graph \(H'\) with a vertex set contained in \(\left( {\begin{array}{c}[n]\\ k\end{array}}\right) \cup \left( {\begin{array}{c}[n]\\ k-1\end{array}}\right) \) such that \(V(H') \cap \left( {\begin{array}{c}[n]\\ k\end{array}}\right) \) is an edge set of a k-partite k-uniform hypergraph. We say that a graph has a partite representation if it has a k-partite representation for some k. Moreover, we call the map that brings V(H) to \(V(H')\), a k-partite embedding of H. For example, if H is an 8-cycle, it has a 2-partite representation with edges 12, 23, 34, 14 corresponding to an 8-cycle with vertices 1, 12, 2, 23, 3, 34, 4, 14, 1, in order. For a k-uniform hypergraph H, \(\textrm{ex}_k(t, H)\) denotes the largest number of edges in a k-uniform t-vertex hypergraph with no subgraph isomorphic to H.

Theorem 7

(Conlon [19]) Let H be a cubical graph with k-partite representation \(\mathcal {H}\), for a fixed k. If \(\textrm{ex}_k(t, \mathcal {H}) \le \alpha t^k\), then \(\textrm{ex}(Q_n, H) = O(\alpha ^{1/k}n2^n)\).

Theorem 8

(Erdős [23]) Let \(k\ge 2\) be an integer and \(K^{k}(\ell _1, \ldots , \ell _k)\) be the complete k-partite k-uniform hypergraph with parts of sizes \(\ell _1, \ldots , \ell _k\). Then \(\textrm{ex}_{k}(t, K^{k}(\ell _1, \ldots , \ell _{k})) = O(t^{k - 1/\delta })\), where \(\delta = \ell _1 \cdots \ell _{k-1}\).

Theorem 8 implies in particular, that \(\textrm{ex}_k(t, \mathcal {H}) \le \alpha t^k\) for \(\alpha < t^{-a}\), for some positive a. Therefore, one can conclude the following fact about the Turán density of graphs having partite representation.

Corollary 9

If H is a cubical graph that has a partite representation then \(\textrm{ex}(Q_n, H)= o(||Q_n||)\).

Note that having a partite representation is not a characterization for graphs H with \(\textrm{ex}(Q_n, H)= o(||Q_n||)\) as shown by the first author in [6]. For more recent results on such extremal hypergraph numbers, see Ma, Yuan, and Zhang [38], as well as Mubayi and Verstraëte [41].

3.2 Subdivisions of Cliques and Bi-cliques

For a graph G, we say that a graph H is a k-subdivision of G and denote it \(T_k(G)\) if H is obtained from G by “inserting” k vertices in each edge of G. Formally, \(V(H)= V(G)\cup \bigcup _{e\in E(G)} V_e\), where V(G) and \(V_e\)’s are pairwise disjoint, \(|V_e|=k\) for each \(e\in E(G)\), and such that G is a union of paths \(P_e\) for \(e\in E(G)\), where \(P_e\) is a path on vertex set \(\{x, y\}\cup V_e\) with endpoints x and y, for \(e=xy\). We shall call vertices from V(G) branch vertices, paths \(P_e\) subdivision paths, and vertices in \(\bigcup _{e\in E(G)} V_e\) subdivision vertices. If k is odd, we say that \(T_k(G)\) is an odd subdivision of G, if k is even, we say that \(T_k(G)\) is an even subdivision of G. Marquardt [40] showed that \(T_k(Q_n)\) has a partite representation for any odd k and any n. Here we prove a more general result about an odd subdivision of any graph.

Theorem 10

For any integer \(k\ge 0\) and any positive integer t, \(T_{2k+1}(K_t)\) is layered. Moreover, for \(k\ge 1\), \(\textrm{ex}(Q_n, T_{2k+1}(K_t)) = O(n^b2^n)= o(||Q_n||)\), where \(b=1-\frac{1}{(k+1)t^k}\).

Proof

Let \(G= T_{2k+1}(K_t)\). We shall be constructing an embedding of G in \(Q_n\), where the ground set [n] is partitioned as follows:

$$\begin{aligned}{}[n] =\bigcup _{x\in V(K_t)} A_x \cup \bigcup _{e\in E(K_t)} B_e, \end{aligned}$$

where \(B_e\)’s and \(A_x\)’s are pairwise disjoint, for each \(x\in V(K_t)\) and \(e\in E(K_t)\). For \(k=0\), let \(A_x=\{x_1\}\) and \(B_e= \emptyset \), \(e\in E(K_t)\). For \(k\ge 1\), let \(A_x=\{x_1, \ldots , x_k\}\) and \(B_e=\{b_e\}\), \(e\in E(K_t)\). So, \(n= tk+\left( {\begin{array}{c}t\\ 2\end{array}}\right) \), for \(k\ge 1\) and \(n=t\) for \(k=0\).

We shall define an embedding f of V(G) into \(V(Q_n)\). Recall that \(V(Q_n)\) is the set of subsets of [n]. If \(x\in V(K_t)\), we also denote the respective branch vertex of G by x. Let \(f(x) = A_x\).

Now, consider two vertices \(x, y\in V(K_t)\) forming an edge e. Let the xy-subdividing path be \(x, z_1, \ldots , z_{2k+1}, y\).

If \(k=0\), then \(f(x) =\{x_1\}\), for any \(x\in V(K_t)\), let \(f(z_1) = \{x_1, y_1\}\).

If \(k\ge 1\), let \(f(z_1) = \{b_e\} \cup f(x)\), \(f(z_{2k+1})= \{b_e\} \cup f(y)\). For \(1\le i \le k-1\), let \(f(z_{2i+1}) = f(z_{2i-1}) - \{x_i\}\cup \{y_i\}\). For \(1\le i\le k\), let \(f(z_{2i}) = f(z_{2i-1})- \{x_i\}\). The embedding f is illustrated in Table 1.

Table 1 Indicator vectors for \(f(x), f(z_1), \ldots , f(z_{2k+1}), f(y)\), respectively, restricted to \(B_e\cup A_{x}\cup A_y\), for \(k=1, 2, \) and 3

This embedding is injective since distinct branch vertices are clearly mapped into distinct vertices of \(Q_n\) not containing \(b_e\) for any \(e\in E(K_t)\). On the other hand, any vertex subdividing an edge e is mapped into one containing \(b_e\), and not containing \(b_{e'}\) for any \(e'\in E(K_t)\), \(e'\ne e\). Thus a vertex subdividing e and a vertex subdividing \(e'\) for \(e\ne e'\) are mapped into distinct vertices.

Finally, we see that the embedding is \((k+1)\)-partite with parts \(\{ x_1: ~ x\in V(K_t)\},\) \( \{x_2: ~ x\in V(K_t)\}\), \(\ldots , \) \(\{ x_k: ~ x\in V(K_t)\},\) and \(\{b_e:~ e\in E(K_t)\}\), of sizes \(t, t, \ldots , t, \) and \(\left( {\begin{array}{c}t\\ 2\end{array}}\right) \), respectively. By Theorem 8 with \(k+1\) instead of k, \(\ell _1= \cdots = \ell _k = t\), and \(\delta = \ell _1 \cdots \ell _{k} = t^k\),

$$\begin{aligned} \textrm{ex}_{k+1}(n, K^{(k+1)}(\ell _1, \ldots , \ell _{k+1})) = O(n^{(k+1) - 1/\delta }) = O(\alpha n^{k+1}), \end{aligned}$$

where \(\alpha = n^{-t^{-k}}.\) Thus by Theorem 7, we have that

$$\begin{aligned} \textrm{ex}(Q_n, G) = O\left( \alpha ^{\frac{1}{k+1}} n2^n\right) = O\left( n^{-\frac{{t^{-k}}}{k+1}} n2^n\right) = o(||Q_n||). \end{aligned}$$

\(\square \)

Next we consider even subdivisions. Since an even subdivision of an odd cycle is an odd cycle, that is not cubical, we only restrict ourselves to even subdivisions of bipartite graphs. We shall consider even subdivisions of complete bipartite graphs. Note that it is easy to see that \(G=T_{2k}(K_{t,t})\) is cubical: We shall consider an embedding f of G into \(Q_n= Q_{2t+ 2k-1}\). Let the parts of G be ordered sets A and B. Let \([n]= X\cup Y\cup Q\), where XYQ are pairwise disjoint sets, \(X=\{x_1, \ldots , x_t\}\), \(Y=\{y_1, \ldots , y_{2k-1}\}\), \(Q=\{q_1, \ldots , q_t\}\), \(|X|=|Q|=t\), \(|Y|=2k-1\).

If \(a\in A\) is the ith vertex from A, let \(f(a) = X-\{x_i\}\). If \(b\in B\) is the jth vertex from B, let \(f(b) = \{q_j\} \cup Y\cup X\). For the ith vertex of A, a, and for the jth vertex of B, b, let the ab-subdivision path be \(a, z_1, z_2, \ldots , z_{2k}, b\), where \(z_i=z_i(a,b)\), \(i=1,\ldots , 2k\). Furthermore, let \(f(z_1)= f(a) \cup \{q_j\}\), \(f(z_\ell ) = f(z_{\ell -1})\cup \{y_{\ell -1}\}\), \(\ell = 2, \ldots 2k\). Note that \(f(z_{2k}) = Y\cup \{q_j\} \cup X-\{x_i\}\). The following theorem proves that G is layered, which in particular implies that G is cubical. However, the embedding presented in the theorem is a bit more involved.

Theorem 11

For any positive integers k and t, \(T_{2k}(K_{t,t})\) is layered. Moreover, for any even integer \(k\ge 4\), and any positive integer t, \(\textrm{ex}(Q_n, T_{2k}(K_{t,t})) = O( n^{b}2^n) = o(||Q_n||)\), where \(b= 1 -\frac{1}{2t(t^2+2)k^{t^2}}\).

Proof

Let \(G= T_{2k}(K_{t,t})\). Let partite sets of \(K_{t,t}\) be A and B, and respective sets of branch vertices in G also be A and B. We shall show that G is layered for \(k\ge 1\). In case when \(k\ge 4\) and even, we show that it has zero Turán density.

Case \(k=1\).  We shall embed G into \(Q_n= Q_{2t+1}\) using the embedding f as follows. Let \([n]= X\cup Y\cup \{q\}\), \(X=\{x_1, \ldots , x_t\}\), \(Y=\{y_1, \ldots , y_{t}\}\), where X, Y and \(\{q\}\) are pairwise disjoint. For the ith vertex a in A, let \(f(a) = \{x_i\} \cup Y\). For the jth vertex b of B, let \(f(b) = Y-\{y_j\} \cup \{q\}\). For the ab-subdivision path \(a, z_1, z_2, b\), let \(f(z_1) = f(a) - \{y_j\}\) and \(f(z_2) = f(z_1) \cup \{q\}\). Then this is an embedding in layers t and \(t+1\).

Case \(k=2\).  We shall embed G into \(Q_n= Q_{2t+3}\) using the embedding f as follows. Let \([n]= X\cup Y\cup \{q_1, q_2, q_3\}\), \(X=\{x_1, \ldots , x_t\}\), \(Y=\{y_1, \ldots , y_{t}\}\), where X, Y and \(\{q_1, q_2, q_3\}\) are pairwise disjoint. For the ith vertex a in A, let \(f(a) = \{x_i\} \cup Y \cup \{q_3\}\). For the jth vertex b of B, let \(f(b) = Y-\{y_j\} \cup \{q_1, q_2\}\). For the ab-subdivision path \(a, z_1, z_2, z_3, z_4, b\), let \(f(z_1) = f(a) - \{y_j\}\), \(f(z_2) = f(z_1) \cup \{q_1\}\), \(f(z_3) = f(z_2) - \{q_3\}\), and \(f(z_4) = f(z_3) \cup \{q_2\}\). This is an embedding in layers \(t+1\) and \(t+2\).

This embedding is injective since for any subdivision vertex z of the edge ab of \(K_{t,t}\), where a is the ith and b is the jth vertex of respective parts A and B, it must be the case that \(f(z)\cap (X\cup Y) = \{x_i\} \cup Y- \{y_j\}\). So subdivision vertices for distinct edges are mapped into distinct vertices. Other pairs of distinct vertices of G are mapped to distinct vertices as witnessed by A, B, or \(\{q_1, q_2, q_3\}\).

Case \(k\ge 3\).  We shall show that G is embeddable in a layer and for even \(k\ge 4\), G has a partite representation. Let \(n= 2t+1+ t^2(k-1)\). Let

$$\begin{aligned}{}[n] =A \cup B \cup \{c\} \cup \bigcup _{e\in E(K_{t,t})} S_e, \end{aligned}$$

where A, B, \(\{c\}\), and \(S_e\)’s are all pairwise disjoint, and for any \(e\in E(K_{t,t})\), \(S_e=\{s_e^1, s_e^2, \ldots , s_e^{k-1}\}\), \(|S_e|=k-1\).

We shall define an embedding f of V(G) into \(V(Q_n)\). Recall that vertices of \(Q_n\) are subsets of [n]. Consider first the branch vertices. Let \(S= \{s_e^1: ~ e\in E(K_{t,t})\}\). For any \(a\in A\), let \(f(a) = \{a,c \}\cup S\) and for any \(b\in B\), let \(f(b) = \{b\}\cup S\).

Now, consider two vertices \(a, b\in V(K_{t,t})\) forming an edge e. Let the ab-subdividing path be \(a, z_1, \ldots , z_{2k}, b \). Let \(S'_e= \{s_{e'}^1: ~ e'\ne e\}\). Then we see that \(f(a) =\{a,c \}\cup S= \{a, c, s_e^1 \} \cup S'_e\) and \(f(b) =\{b\}\cup S= \{b, s_e^1\}\cup S'_e\). Let

$$\begin{aligned} f(z_1)= & {} \{a, c \} \cup S'_e, \quad f(z_2) = \{a, c, s_e^2 \} \cup S'_e\\ f(z_3)= & {} \{ c, s_e^2\} \cup S'_e, \quad f(z_4) = \{b, c, s_e^2\} \cup S'_e \\ f(z_5)= & {} \{b, s_e^2 \} \cup S'_e, \quad f(z_{2k}) = f(z_{2k-1})\cup \{s_e^1\}. \end{aligned}$$

Furthermore, for \(k\ge 4\) and \( 1\le i \le k-3\), let

$$\begin{aligned} f(z_{6+2i-2} ) = f(z_{6+2i-3}) \cup \{s_e^{2+i}\}~~ \text{ and } ~~f(z_{6+2i-1} ) = f(z_{6+2i-2}) -\{s_e^{1+i}\}. \end{aligned}$$

This is an embedding into layers \(t^2\) and \(t^2+1\) because each \(S'_e\) has size \(t^2-1\). In Table 2, we illustrate this embedding.

Table 2 Indicator vectors for \(f(a), f(z_1), \ldots , f(z_{2k}), f(b)\), respectively, restricted to \(a, b, c, s_e^1, s_e^2, \ldots , s_e^{k-1}\) in order, for \(k=3, 4, \) and 5

This embedding is injective since distinct branch vertices are clearly mapped into distinct vertices of \(Q_n\). Moreover, any branch vertex x and any subdivision vertex z are mapped to different vertices by f because \(f(x) \cap \bigcup _{e\in E(K_{t,t})} S_e = S\) and \(f(z) \cap \bigcup _{e\in E(K_{t,t})} S_e \ne S\). For any two vertices \(z, z'\) subdividing an edge e, it is clear from the definition that \(f(z)\ne f(z')\). Finally for a vertex z subdividing an edge e and vertex \(z'\) subdividing an edge \(e'\), \(e\ne e'\), \(f(z) \cap S_e \ne f(z') \cap S_{e'}\).

We see that, for even \(k\ge 4\), this embedding gives a partite representation with parts

  • \(A\cup B\),

  • \(\{s_e^1, s_e^2, s_e^4, s_e^6, \ldots \}\), \(e\in E(K_{t,t})\), and

  • \(\{c\} \cup \bigcup _{e\in E(K_{t,t})} \{s_e^3, s_e^5, s_e^7, \ldots \}.\)

The sizes \(\ell _1, \ldots , \ell _{t^2+2}\) of the parts are at most \(2t, k, k, \ldots , k, kt^2\), respectively. By Theorem 8, with \(q= t^2+2\) instead of k, and \(\delta = \ell _1 \cdots \ell _{q-1} \le 2t\cdot k^{t^2}\),

$$\begin{aligned} \textrm{ex}_{q}(n, K^{q}(\ell _1, \ldots , \ell _{q})) = O\left( n^{q - \frac{1}{\delta }}\right) = O(\alpha n^{q}), \end{aligned}$$

where \(\alpha = n^{-1/\delta }.\) Note that \(\alpha ^{\frac{1}{q}}=n^{-\frac{{1}}{\lambda }}\) for \(\lambda =2t(t^2+2)k^{t^2}\). Thus, by Theorem 7, we have that

$$\begin{aligned} \textrm{ex}(Q_n, G) = O\left( \alpha ^{\frac{1}{q}} n2^n\right) = O\left( n^{-\frac{{1}}{\lambda }} n2^n\right) = o(||Q_n||). \end{aligned}$$

\(\square \)

4 Layered Embedding of Theta Graphs, Non-layered Graphs of Girth Eight, Proof of Theorem 3

A graph is a theta graph with legs of length \(\ell _1, \ldots , \ell _k\) and poles v and \(v'\) if it is a union of k paths of lengths \(\ell _1, \ldots , \ell _k\) with endpoints v and \(v'\) whose vertex sets pairwise share only \(\{v, v'\}\). Here, we shall denote the Hamming distance between two sets or two binary sequences xy as \(d_H(x,y)\). Note that \(C_4\) is a theta graph with two legs of length 2 and it is not a layered graph.

Lemma 12

If G is a theta graph with arbitrary number of legs of length \(m\ge 3\) each, then G is cubical. If G is a theta graph with 3 legs of length 2 each, i.e., \(G=K_{2,3}\), then G is not cubical.

Proof

We shall define an edge-coloring of G as follows. Let the edges of the ith leg incident to the poles be colored i, \(i=1, \ldots , m\). Let all edges at distance k from the first pole be colored \(x_k\), \(k=1, \ldots , m-2\), for distinct \(x_1, \ldots , x_{m-2}\) different from any of \(1, \ldots , m\). Then this coloring satisfies the properties of Havel–Moravek, [32]. To prove the second statement of the lemma, observe that a nice coloring must assign colors 1, 2, 1, 2 to the edges of any \(C_4\) up to renaming the colors. This is impossible to maintain in a \(K_{2,3}\). \(\square \)

Lemma 13

Let G be a theta graph with poles a and \(a'\) and t legs of length m each, \(t>\lceil \frac{m}{2} \rceil \). If G is a subgraph of a layer, then \(d_H(a, a')<m\).

Proof

Assume that \(d_H(a, a')\ge m\). Since there is a path of length m between a and \(a'\), \(d_H(a, a')=m\). Assume without loss of generality that a is in a lower or the same layer as \(a'\). Let S be the set of m coordinates where a and \(a'\) differ. Since the number of 0’s in a and \(a'\) differ by at most one, a has at most \(\lceil \frac{m}{2} \rceil \) zeros in positions from S. Then for any \(a, a'\)-path P of length m, and any \(s\in S\), there should be an edge with a star with position in s. Thus, each edge of P has stars only in positions from S. Moreover, a first edge of P can have stars only in positions corresponding to 0’s of a. Hence, there are at most \(\lceil \frac{m}{2} \rceil \) such edges. Thus, \(t\le \lceil \frac{m}{2} \rceil \). \(\square \)

Lemma 14

Let G be a theta graph with poles a and \(a'\) with 3 legs of length 3 each. Then G is not embeddable in a layer.

Proof

Assume that G is layered. By Lemma 13 we have that \(d_H(a, a') <3\). Since a and \(a'\) are in different vertex layers, \(d_H(a, a') =1\). Then the edge \(aa'\) and one of the legs of G form a \(C_4\), a contradiction since \(C_4\) is not a layered graph. \(\square \)

Let \(G_8'\) be a theta graph with poles a and \(a'\), three legs of length 4 each, a vertex u adjacent to a on one leg and a vertex \(u'\) adjacent to \(a'\) on another leg. Let \(G_8\) be a union of \(G_8'\) and a \(u,u'\)-path of length 4 internally disjoint from \(G_8'\). See Fig. 1 (i).

Fig. 1
figure 1

(i) Embedding of \(G_8\) into \(Q_5\), (ii) the layered graph \(G_8\cup P_a \cup P_u\)

Now, Theorem 3 follows immediately from the following lemma.

Lemma 15

The graph \(G_8\) is cubical, girth 8 and not layered.

Proof

To see that \(G_8\) is cubical, see an embedding in \(Q_5\) shown in Fig. 1 (i). From now on, we assume that \(G_8\) is embedded into two vertex layers \(V_\ell \) and \(V_{\ell +1}\) of \(Q_n\) for some n. Let \(X=V_\ell \cup V_{\ell +1}\).

By Lemma 13 and using parity, \(d_H(u,u')=d_H(a,a')=2\) and thus in particular, u and \(u'\) are in the same layer of \(Q_n\) and a and \(a'\) are in the same layer of \(Q_n\). Consider internal vertices \(a''\), \(u''\) on a shortest \(a,a'\)-path \(P_a\) and \(u,u'\)-path \(P_u\) in \(Q_n\), respectively, such that \(a'', u''\in X\). We see that \(a''\ne u''\) and \(a'' , u'' \not \in V(G_8)\) since otherwise \(G_8\) contains a 4-cycle. Then \(G_8\cup P_a \cup P_u\) is embedded in X and thus has a very nice coloring c. We know that the edges in any 6-cycle in \(Q_n\) have exactly three directions giving a very nice coloring, 123123, up to renaming the colors. In particular, for the 6-cycle \(uaa''a'u'u''u\) we have that \(c(ua)=c(u'a')\). However, there is a path P of length 3 between ua and \(u'a'\), see Fig. 1 (ii), contradicting the fact that c is very nice. \(\square \)

5 Lower Bounds for \(\textrm{ex}(Q_n, C_{10})\), Proof of Theorem 4

In order to obtain a lower bound on \(\textrm{ex}(Q_n, C_{10})\), we shall make a construction that uses a construction by Conder [18] several times. Conder’s construction uses an edge-coloring of \(Q_n\) that we call a prefix coloring. Recall that we represent an edge AB, \(A\subseteq B\) in \(Q_n\) by a sequence of length n, where the ith position is occupied by 0 if \(i\notin B\), by 1 if \(i\in A\) and by \(\star \) if \(i\in B{\setminus } A\). If e is a vector of 1s, 0s, and a star, let \(\textrm{pre}(e)\) be the number of 1’s in the positions of e preceding the star position and \(\textrm{suf}(e)\) be the number of 1’s in the positions of e following the star position. Let

$$\begin{aligned} f(e)= \textrm{pre}(e)-\textrm{suf}(e) \pmod 3. \end{aligned}$$

Then f is called the prefix coloring of e. For example \(f(01001\star 01) = 2 - 1 =1 \mod 3 \).

Proof of Theorem 4

We are to prove that \(\textrm{ex}(Q_n, C_{10}) = \Omega \left( \frac{n2^n}{\log ^a n} \right) \), where \(a = \log _2 3\). Let \(\pi \) be a permutation of [n]. For an edge \(e=(x_1, \ldots , x_n)\) of \(Q_n\) given in star representation, we let \(e_\pi \) be the representation of e with respect to \(\pi \), that is, a vector \((x_{\pi (1)}, \ldots , x_{\pi (n)})\). Let \(\Pi \) be a smallest set of permutations of [n] such that for any ordered set (abc), with distinct elements \(a, b, c \in [n]\), there is \(\pi \in \Pi \) such that \(\pi ^{-1}(a)< \pi ^{-1}(b)\) and \(\pi ^{-1}(a)< \pi ^{-1}(c)\). By a result of Spencer [43], there exists such a set with \(|\Pi |\le \log _2\log _2 n\). Let \(\Pi = \{\pi _1, \pi _2, \ldots \}\).

We shall define an edge-coloring g of \(E(Q_n)\) as follows. Let, for \(e\in E(Q_n)\),

$$\begin{aligned} g(e) = \left( g_0(e), g_{\pi _1}(e), \ldots , g_{\pi _{|\Pi |}}(e)\right) , \end{aligned}$$

where for any \(\pi \in \Pi \) we have that \(g_\pi (e)\) is a prefix coloring, i.e., \(g_\pi (e)=f(e_{\pi })\) and \(g_0(e)\) is equal to the parity of a layer containing e, i.e., \(g_0(e)\) is 0 if e is in an even layer and it is 1 if e is in an odd layer.

Since each prefix coloring uses exactly three colors, the total number of colors used by g is \(2\cdot 3^{|\Pi |}\). We shall argue that there is no monochromatic \(C_{10}\) under this coloring. Then taking a largest color class of g, we obtain a desired \(C_{10}\)-free subgraph of \(Q_n\).

Consider a copy C of \(C_{10}\) in \(Q_n\). If C is monochromatic under g, it is in particular monochromatic under \(g_0\). Note that since C is connected, and \(g_0\) distinguishes even and odd edge layers, C must be contained in some edge layer. Consider a very nice coloring \(\eta \) of C corresponding to the directions of its edges. Each color in \(\eta \) must appear an even number of times. If there is a color in \(\eta \) that appears 4 times, there are two edges of that color that are at distance at most 1, contradicting the fact that \(\eta \) is very nice. Thus each color in \(\eta \) appears exactly twice. Let these colors be abcde. I.e., C has exactly 5 star positions on its edges and these positions are abcde. All vertices of C coincide on all other positions.

Consider a hypergraph \(H_C\) on the vertex set \(\{a, b, c, d, e\}\), whose hyperedges correspond to non-zero positions of edges of C, restricted to \(\{a, b, c, d, e\}\). Because the number of 1s in every edge must be the same, \(H_C\) is a uniform hypergraph of uniformity 2, 3,  or 4, such that in some of the edge-orderings, considering intersections of consecutive edges, gives us 5 distinct sets. As can be seen by inspection, the possible such hypergraphs \(H_C\), up to a permutation of \(\{a, b, c, d, e\}\) are \(H_1=\{ab, bc, cd, de, ea\}\), \(H_2=\{abc, bcd, cde, dea, eab\}\), \(H_3=\{cde, dea, aeb, ebc, bcd\}\), \(H_4=\{abc, bcd, cde, bde, bda\}\), or \(H_5=\{abcd, bcde, cdea, deab, eabc\}\), as shown in Fig. 2. See the respective edges of \(H_1, H_2, H_3\) and \(H_4\) in the list below. Note that \(H_5\) is very similar to \(H_1\) and is obtained by switching 1’s and 0’s in the star representations of the edges. We shall thus not consider \(H_5\).

Fig. 2
figure 2

Hypergraphs \(H_1\), \(H_2\), \(H_3\) and \(H_4\) with corresponding 10-cycle C

Table 3 Star representation of edges in C where \(H_C=H_i\), \(i\in [4]\)

We show that C is not monochromatic under some \(g_\pi \), \(\pi \in \Pi \). We distinguish four cases depending on \(i\in [4]\) with \(H_C=H_i\). Note that in the first three cases we actually prove that C is not monochromatic under any \(g_\pi \). Fix an arbitrary permutation \(\pi \in \Pi \) and assume that C is monochromatic under \(g_\pi \).

For any two distinct \(x,y\in \{a,b,c,d,e\}\) we define an indicator function \(\overrightarrow{xy}= \overrightarrow{xy}_\pi \) that is equal to 1 if x appears before y in \(\pi \), and it is equal to \(-1\) otherwise. Note that \(\overrightarrow{xy}=-\overrightarrow{yx}\), in particular \(\overrightarrow{xy}\ne \overrightarrow{yx}\). In the remainder of the proof all equations are considered modulo 3. Let \(e_1^x\) and \(e_2^x\) be any two edges in C with star position at the same \(x\in \{a,b,c,d,e\}\). Then let \(X_j=\big \{y\in \{a,b,c,d,e\}: ~ e_j^x\) has a 1 at position \(y\big \}\) for \(j\in [2]\). Note that the prefix coloring of \(e_j^x\) with respect to permutation \(\pi \) and restricted to \(\{a,b,c,d,e\}\) is equal to the sum \(\sum _{y\in X_j} \overrightarrow{yx}_\pi \). In every position other than \(\{a,b,c,d,e\}\) both \(e_1^x\) and \(e_2^x\) coincide. Thus, if \(e_1^x\) and \(e_2^x\) have the same color, then

$$\begin{aligned} \sum _{y\in X_1} \overrightarrow{yx}=\sum _{y\in X_2} \overrightarrow{yx}. \end{aligned}$$
($*$)

For example consider the two edges \(e_1^a\) and \(e_2^a\) in C with star position at a, where \(H_C=H_2\), as indicated in Table 3. Then \(X_1=\{b,c\}\) and \(X_2=\{d,e\}\) and the edges differ only in positions \(X_1\cup X_2\), therefore \(e_1^a\) and \(e_2^a\) have the same color only if \(\overrightarrow{ba}+\overrightarrow{ca}=\overrightarrow{da}+\overrightarrow{ea}\).

Case 1. \(H_C=H_1\).

Applying \((*)\) for the two edges of C with star position at a provides that \(\overrightarrow{ba}=\overrightarrow{ea}\).

Similarly, considering edges with star positions at bcd, and e, we have \(\overrightarrow{ab}=\overrightarrow{cb}, ~ \overrightarrow{bc}=\overrightarrow{dc}, ~ \overrightarrow{cd}=\overrightarrow{ed}, ~ \overrightarrow{de}=\overrightarrow{ae}.\) Then \(\overrightarrow{ba}=\overrightarrow{ea}=-\overrightarrow{de}=\overrightarrow{cd}=-\overrightarrow{bc}=\overrightarrow{ab}\). This is a contradiction.

Case 2. \(H_C=H_2\).

Applying \((*)\) for pairs of edges with star positions in \(\{a,b,c,d,e\}\) we obtain five equations, which we then add up:

$$\begin{aligned} {\left\{ \begin{array}{ll} \begin{array}{l} \overrightarrow{ba}+\overrightarrow{ca}=\overrightarrow{da}+\overrightarrow{ea}\\ \overrightarrow{cb}+\overrightarrow{db}=\overrightarrow{eb}+\overrightarrow{ab}\\ \overrightarrow{ac}+\overrightarrow{bc}=\overrightarrow{dc}+\overrightarrow{ec}\\ \overrightarrow{bd}+\overrightarrow{cd}=\overrightarrow{ed}+\overrightarrow{ad}\\ \overrightarrow{ae}+\overrightarrow{be}=\overrightarrow{ce}+\overrightarrow{de} \end{array} \end{array}\right. } \Longrightarrow {\left\{ \begin{array}{ll} \begin{array}{l} \overrightarrow{ba}+\overrightarrow{cd}+\overrightarrow{ae}+\overrightarrow{be}=\overrightarrow{ea}+\overrightarrow{eb}+\overrightarrow{ab}+\overrightarrow{dc}. \end{array} \end{array}\right. } \end{aligned}$$

As a result \(0=\overrightarrow{ea}+\overrightarrow{eb}+\overrightarrow{ab}+\overrightarrow{dc}\). If \(\overrightarrow{ea} = \overrightarrow{ab}\), the transitivity in \(\pi \) implies that \(\overrightarrow{eb}=\overrightarrow{ea} = \overrightarrow{ab}\). Recall that all equations are considered modulo 3. Therefore, \(\overrightarrow{ea}+\overrightarrow{eb}+\overrightarrow{ab}=0\), so \(\overrightarrow{dc}=0\), which is a contradiction. Thus, \(\overrightarrow{ae} = \overrightarrow{ab}\). By a symmetric argument \(\overrightarrow{ab}=\overrightarrow{cb}, ~ \overrightarrow{bc}=\overrightarrow{dc}, ~ \overrightarrow{cd}=\overrightarrow{ed}, ~ \overrightarrow{de}=\overrightarrow{ae}.\) This is exactly the condition obtained in Case 1, a contradiction.

Case 3. \(H_C=H_3\).

In this case, again consider pairs of edges with star positions at a, b, etc. and for each pair set up an equation:

$$\begin{aligned} {\left\{ \begin{array}{ll} \begin{array}{l} \overrightarrow{ea}+\overrightarrow{ba}=\overrightarrow{da}+\overrightarrow{ea}\\ \overrightarrow{cb}+\overrightarrow{db}=\overrightarrow{eb}+\overrightarrow{ab}\\ \overrightarrow{dc}+\overrightarrow{ec}=\overrightarrow{bc}+\overrightarrow{ec}\\ \overrightarrow{bd}+\overrightarrow{cd}=\overrightarrow{ad}+\overrightarrow{ed}\\ \overrightarrow{ce}+\overrightarrow{be}=\overrightarrow{ce}+\overrightarrow{de} \end{array} \end{array}\right. } \Longrightarrow {\left\{ \begin{array}{ll} \begin{array}{l} \overrightarrow{ba}=\overrightarrow{da}\\ \overrightarrow{bc}+\overrightarrow{bd}=\overrightarrow{be}+\overrightarrow{ba}\\ \overrightarrow{dc}=\overrightarrow{bc}\\ \overrightarrow{db}+\overrightarrow{dc}=\overrightarrow{da}+\overrightarrow{de}\\ \overrightarrow{be}=\overrightarrow{de} \end{array} \end{array}\right. } \Longrightarrow {\left\{ \begin{array}{ll} \begin{array}{l} \overrightarrow{dc}+\overrightarrow{bd}=\overrightarrow{de}+\overrightarrow{da}\\ \overrightarrow{db}+\overrightarrow{dc}=\overrightarrow{da}+\overrightarrow{de}. \end{array} \end{array}\right. } \end{aligned}$$

Thus \(\overrightarrow{bd}=\overrightarrow{db}\), which is a contradiction.

Case 4. \(H_C=H_4\).

In each of the prior cases, we showed that C cannot be monochromatic under any \(\pi \in \Pi \). In this case, there may be exist a permutation \(\pi \in \Pi \) such that C is monochromatic under \(g_{\pi }\), see for example, the order of abcde as in Table 3. Thus for \(H_4\), we will only show that C is not monochromatic for some \(g_{\pi '}\), \(\pi '\in \Pi \). Assume that C is monochromatic under g. Then for any permutation \(\pi \in \Pi \), considering pairs of edges with star positions at b and e, the following two equations hold:

$$\begin{aligned} {\left\{ \begin{array}{ll} \begin{array}{c} \overrightarrow{cb}+\overrightarrow{db}=\overrightarrow{eb}+\overrightarrow{db}\\ \overrightarrow{ce}+\overrightarrow{de}=\overrightarrow{be}+\overrightarrow{de}\\ \end{array} \end{array}\right. } \Longrightarrow {\left\{ \begin{array}{ll} \begin{array}{c} \overrightarrow{cb}=\overrightarrow{eb}=\overrightarrow{ec}. \end{array} \end{array}\right. } \end{aligned}$$

Thus c is between e and b. By the way \(\Pi \) was selected, there is some permutation \(\pi ' \in \Pi \) such that c precedes both b and e, a contradiction.

Thus, in at least some coloring \(g_\pi \), \(\pi \in \Pi \), C is not monochromatic. Therefore, C is not monochromatic under the coloring g. The number of colors used by g is \(2\cdot 3^{|\Pi |} \le 2 \cdot 3^{\log _2\log _2 n} = 2\cdot (\log _2 n)^{\log _2 3}\). Consider a largest color class of g having \(n2^{n-1}/ 2\cdot (\log _2 n)^{\log _2 3}\) edges. It contains no copy of \(C_{10}\). \(\square \)

Next, we remark that there is a lower bound on \(\textrm{ex}(Q_n, C_{10})\) using a special extremal function for a smaller graph.

Let \(\textrm{ex}^*(Q_n, C_6^-)\) be the largest number of edges in a subgraph G of \(Q_n\) such that G contains no \(C_6^-\), that is a subgraph H of \(Q_n\) on 6 vertices and 5 edges such that H is a subgraph of \(C_6\) in \(Q_n\). Note, that \(C_6^-\) forms a path of length 5, but not every path of length 5 is a \(C_6^-\). For example, the path 00000, 00001, 00011, 00111, 01111, 11111 is not a \(C_6^-\) because its edges do not form a subgraph of a 6-cycle.

Lemma 16

\(\textrm{ex}^*(Q_n, C_6^-)/3 \le \textrm{ex}(Q_n, C_{10})\).

Proof

Let G be a \(C_6^-\)-free subgraph of \(Q_n\). Let c be a prefix coloring of G and let \(G'\) be a subgraph of G on at least ||G||/3 edges such that the edges of \(G'\) have the same color under c. We have that \(||G'|| \ge \textrm{ex}^*(Q_n, C_6^-)/3\). We shall argue that \(G'\) is \(C_{10}\)-free. To see that \(G'\) has no induced \(C_{10}\) we refer to [5], where this fact was verified using a case analysis similar to the proof of Theorem 4 presented in Sect. 5. Consider a non-induced copy C of \(C_{10}\). It is formed by a union of two 6-cycles that share exactly one edge, and removing their common edge. So, in this case C contains \(C_6^-\) as a subgraph. Since \(G'\) does not contain C as a subgraph, \(G'\) is \(C_{10}\)-free. \(\square \)

We have an exact value for \(\textrm{ex}^*(Q_n, C_6^-)\) if \(n=3\):

Lemma 17

\(\textrm{ex}^*(Q_3, C_6^-)=8\).

Proof

To see that \(\textrm{ex}^*(Q_3, C_6^-)\ge 8\) consider a subgraph of \(Q_3\) that is a vertex disjoint union of two \(C_4\)’s. For the upper bound it suffices to show that \(\textrm{ex}(Q_3, C_6)\le 9\). Let G be a subgraph of \(Q_3\) on 10 edges. It is easy to check that in each configuration of the two non-present edges, there is a 6-cycle, see Fig. 3. \(\square \)

Fig. 3
figure 3

6-cycle in \(Q_3\) in each configuration of non-present edges (dotted)

6 Density of Layered Graphs

In this section we prove some results about density of layered graphs. We show that under classical compression operation the density of a layered graph is not decreased. Moreover, if the compressed graph corresponds to initial intervals in colex order, we can show that the asymptotic density of the graph is at most half of the largest density of a cubical graph on the same number of vertices.

Let k and n be integers, \(0\le k\le n\), \(\mathcal {A}\subseteq \left( {\begin{array}{c}[n]\\ k\end{array}}\right) \), and \(\mathcal {B}\subseteq \left( {\begin{array}{c}[n]\\ k-1\end{array}}\right) \). Then we define the graph \(Q(n,k;\mathcal {A},\mathcal {B})\) to be a bipartite graph with vertex set \(\mathcal {A}\cup \mathcal {B}\) where \(A\in \mathcal {A}\) is adjacent to \(B\in \mathcal {B}\) if and only if \(B\subset A\), i.e., a graph induced by \(\mathcal {A}\cup \mathcal {B}\) in \(Q_n\).

Fix integers ki,  and j, where \(0\le k\le n\), \(1\le i<j\le n\), and let \(\mathcal {A}\subseteq \left( {\begin{array}{c}[n]\\ k\end{array}}\right) \) and \(\mathcal {B}\subseteq \left( {\begin{array}{c}[n]\\ k-1\end{array}}\right) \). Let \(R_{ij}\) be the shift operator also called compression operator. That is, for any set \(X\in \mathcal {A}\cup \mathcal {B}\),

$$\begin{aligned} R_{ij}(X) = \left\{ \begin{array}{ll} (X-\{j\})\cup \{i\}, \quad &{}\text{ if } i\not \in X, ~ j\in X, \hbox {and} (X-\{j\})\cup \{i\}\not \in \mathcal {A}\cup \mathcal {B};\\ X, \quad &{}\text{ else. } \end{array}\right. \end{aligned}$$

Note that this is a classical shift operator used in proving, for example, the Kruskal–Katona theorem, see a survey by Frankl and Tokushige [25]. For a nice account of the properties of the shift operation, see a summary by Das [20]. A family \(\mathcal {X}\) is called compressed if for any \(i<j\), \(R_{ij}(\mathcal {X}) = \mathcal {X}\), where \(R_{ij}(\mathcal {X}) = \{ R_{ij}(X): X\in \mathcal {X}\}\). Note that \(|\mathcal {X}|= |R_{ij}(\mathcal {X})|\).

The following lemma shows that the compression does not decrease the size of a layered graph.

Lemma 18

Let kij and n be integers, \(0\le k\le n\), \(1\le i<j\le n\), \(\mathcal {A}\subseteq \left( {\begin{array}{c}[n]\\ k\end{array}}\right) \), and \(\mathcal {B}\subseteq \left( {\begin{array}{c}[n]\\ k-1\end{array}}\right) \).

\(||Q(n,k;\mathcal {A},\mathcal {B})|| \le ||Q(n,k; R_{ij}(\mathcal {A}), R_{ij}(\mathcal {B}))||.\)

Proof

Define \( \mathcal {A}'= {R}_{ij}(\mathcal {A})\) and \(\mathcal {B}' ={R}_{ij}(\mathcal {B}).\) Let \(G= Q(n,k;\mathcal {A},\mathcal {B})\) and \(G' = Q(n,k;\mathcal {A}',\mathcal {B}').\) We shall show that \(||G|| \le ||G'||\). Let us denote \(R_{ij}(B)\) as \(B'\) for any \(B\in \mathcal {B}\) and \(R_{ij}(A)\) as \(A'\) for any \(A\in \mathcal {A}\).

Consider \(B\in \mathcal {B}\) and \(i<j\). If the set \(B-\{j\}\cup \{i\} \in \mathcal {B}-\{B\}\), we denote this set as \(B^*\), i.e., \(B^*= B-\{j\}\cup \{i\}\) and say that \(B^*\) is the successor of B and B is the predecessor of \(B^*\). Note that \(B^*\) itself does not have a successor, each \(B\in \mathcal {B}\) has at most one successor and at most one predecessor. Let \(\mathcal {B}= \mathcal {B}_0\cup \mathcal {B}_1\), where \(\mathcal {B}_0\) consists of all B’s from \(\mathcal {B}\) that have neither successors nor predecessors and \(\mathcal {B}_1= \mathcal {B}-\mathcal {B}_0\), a set that can be partitioned into pairs \(B, B^*\). We shall treat elements of \(\mathcal {B}_0\) as singletons and split elements of \(\mathcal {B}_1\) into sets of size two consisting of a set and its successor. We shall argue that any vertex from \(\mathcal {B}_0\) after the shift has a degree in \(G'\) as high as its degree in G. In addition, we shall argue that for any pair \(\{B, B^*\}\) in \(\mathcal {B}_1\), the number of edges incident to B or \(B^*\) after the shift in \(G'\) is as large as the number of edges incident to B or \(B^*\) in G. This will immediately imply that \(||G||\le ||G'||\).

We consider the cases:

  1. 1.

    \(B\in \mathcal {B}_0\)

    1. (a)

      \(i\not \in B\) and \(j\in B\) In this case \(B' = B-\{j\}\cup \{i\}\). If \(AB\in E(G)\), then \(A=B\cup \{t\}\), \(t\ne j\). If \(t=i\), then \(A'=A\) and \(A'B' \in E(G')\). If \(t\ne i\), then \(i\not \in A\). If \(A' = A-\{j\} \cup \{i\}\), then \(A'B'\in E(G')\). If \(t\ne i\) and \(A'=A\), we have that \(A_t=A-\{j\}\cup \{i\} \in \mathcal {A}\). Then we have that \(A_tB' \in E(G')\). We see that \(\deg _{G'}(B') = \deg _G(B)\).

    2. (b)

      \(i\in B\) or \(j\not \in B\) In this case \(B'=B\). If \(i\in B\), then for any \(A\in \mathcal {A}\) such that \(AB\in E(G)\), \(i\in A\), thus \(A'=A\). Thus, \(A'B'\in E(G')\) in this case. If \(i\not \in B\) and \(j\not \in B\) and \(AB\in E(G)\), we have two subcases. If \(A'=A\), then \(A'B'\in E(G')\). Otherwise \(j\in A, i\not \in A\). Then \(A'= A-\{j\}\cup \{i\}\) and \(A'B'\in E(G')\).

  2. 2.

    \(B\in \mathcal {B}_1\) In this case we shall consider a pair \(B, B^*\) assuming without loss of generality that B has successor \(B^*\). We shall argue that \(\deg _G(B)+\deg _G(B^*) \le \deg _{G'}(B') +\deg _{G'}({B^*}')\). We have \(i\not \in B\), \(j\in B\), and \(B' = B\). Thus, we have that \(\{B', {B^*}'\}=\{B, B^*\}\). If \(AB\in E(G)\) and \(AB^*\in E(G)\) then \(A=B\cup \{i\}\) and \(A'=A\). Then \(A'B', A'{B^*}' \in E(G')\). If \(AB\in E(G)\) and \(AB^*\not \in E(G)\), then \(j\in A\), \(i\not \in A\). Thus either \(A'B^* \in E(G')\) or \(A'B\in E(G')\) depending whether \(A'\ne A\) or \(A'=A\), respectively. If \(AB\not \in E(G)\) and \(AB^*\in E(G)\), then \(j\not \in A\), \(i\in A\). Thus, \(A' = A\) and \(A'B'\in E(G')\). So, we see that for any \(A'\in \mathcal {A}\), \(A'\) sends at least as many edges to \(\{B, B^*\}\) in \(G'\) as A to \(\{B, B^*\}\) in G.

This shows that \(||G||\le ||G'||\). Now, we repeat this shift operation for all pairs \(i<j\) and produce two compressed families \(\mathcal {A}'' \subseteq \left( {\begin{array}{c}[n]\\ k\end{array}}\right) \) and \(\mathcal {B}''\subseteq \left( {\begin{array}{c}[n]\\ k-1\end{array}}\right) \), \(|\mathcal {A}|=|\mathcal {A}''|\), \(|\mathcal {B}|=|\mathcal {B}''|\), as well as a graph \(G''= Q(n, k, \mathcal {A}'', \mathcal {B}'')\) such that \(||G''||\ge ||G||\), as desired. \(\square \)

We say that the graph is in the kth layer if its edges are in the kth edge layer of some hypercube.

So, we see that in order to find a largest density of a t-vertex layered graph, it is sufficient to find such a density for a compressed graph. A special class of compressed set families are those corresponding to the initial interval in colex order. Unfortunately there are compressed families, for example \(\{ \{1,2\}, \{1,3\}, \{1,4\}\}\) that do not form an initial interval in colex order.

Next, we shall consider only families forming initial segments in colex order. A set A is less than set B in the colex order if the largest element in the symmetric difference of A and B is in B. For positive integers \(N_A\) and \(N_B\), we define the graph \(Q(n,k;N_A,N_B)\) to be the graph \(Q(n,k;\mathcal {A},\mathcal {B})\) where \(\mathcal {A}\subseteq \left( {\begin{array}{c}[n]\\ k\end{array}}\right) \) and \(\mathcal {B}\subseteq \left( {\begin{array}{c}[n]\\ k-1\end{array}}\right) \), are families, of sizes \(N_A\) and \(N_B\) respectively, that form initial intervals in colex order. We call a graph a colex-interval or colex-interval graph if it is equal to \(Q(n,k;N_A,N_B)\) for some \(n, k, N_A, \) and \(N_B\).

A layered graph in the kth layer is a super-colex-interval if it is a colex-interval and equal to \(Q(a,k;\mathcal {A},\mathcal {B})\) for some integer a, where \(\left( {\begin{array}{c}[a-1]\\ k\end{array}}\right) \subset \mathcal {A}\subseteq \left( {\begin{array}{c}[a]\\ k\end{array}}\right) \) and \(\left( {\begin{array}{c}[a-1]\\ k-1\end{array}}\right) \subseteq \mathcal {B}\subseteq \left( {\begin{array}{c}[a]\\ k-1\end{array}}\right) \). In particular, if G is a super-colex-interval graph on t vertices and in layer k, then \(\left( {\begin{array}{c}a-1\\ k\end{array}}\right) + \left( {\begin{array}{c}a-1\\ k-1\end{array}}\right) < t \le \left( {\begin{array}{c}a\\ k\end{array}}\right) + \left( {\begin{array}{c}a\\ k-1\end{array}}\right) \), i.e., \(\left( {\begin{array}{c}a\\ k\end{array}}\right) < t \le \left( {\begin{array}{c}a+1\\ k\end{array}}\right) \).

Lemma 19

Let k and t be natural numbers. Let G be a colex-interval graph in layer k with \(|G|=t\). Then the number of edges in G is either at most 2t or at most the number of edges in a super-colex-interval graph on t vertices in layer k.

Proof

Let \(G=Q(n, k; \mathcal {A}, \mathcal {B})\), where \(|G|= |\mathcal {A}|+|\mathcal {B}|=t\), for some n, and G has a largest number of edges among colex-interval graphs on t vertices. We can assume that \(3\le k \le n-2\), because otherwise the degrees of vertices in one part of G are at most 2, so \(||G|| \le 2t\) and we are done.

Since G is a colex-interval, \(\mathcal {A}\) and \(\mathcal {B}\) are initial segments in colex order. We assume also that \(\mathcal {A}\) and \(\mathcal {B}\) are non-empty. Thus,

$$\begin{aligned} \left( {\begin{array}{c}[a-1]\\ k\end{array}}\right) \subset \mathcal {A}\subseteq \left( {\begin{array}{c}[a]\\ k\end{array}}\right) \text{ and } \left( {\begin{array}{c}[b-1]\\ k-1\end{array}}\right) \subset \mathcal {B}\subseteq \left( {\begin{array}{c}[b]\\ k-1\end{array}}\right) , \end{aligned}$$

for some positive integers a and b. If \(b=a\) or \(\mathcal {B}=\left( {\begin{array}{c}[a-1]\\ k-1\end{array}}\right) \), then G is a super-colex-interval. Otherwise we shall find a contradiction. We shall be treating \(\mathcal {A}\) and \(\mathcal {B}\) as linearly ordered sets with respect to colex order.

Assume that \(b>a\). Then any vertex \(B\in \mathcal {B}\) that contains b has no neighbors in \(\mathcal {A}\). We can replace B with \(A'\), the member of \(\left( {\begin{array}{c}[n]\\ k\end{array}}\right) -\mathcal {A}\) which is smallest in colex order. Then \(A'\) has some neighbors in \(\mathcal {B}-\{B\}\), contradicting the maximality of ||G||.

Now assume that \(b\le a-1\) and \(\mathcal {B}\ne \left( {\begin{array}{c}[a-1]\\ k-1\end{array}}\right) \). In this case we can take \(n=a\). We assumed in the beginning of the proof that \(k\le n-2 = a-2\). Let A be the last vertex of \(\mathcal {A}\) in colex order. Note that \(a\in A\), thus A has at most one neighbor in \(\mathcal {B}\). We replace A with the vertex \(B' \in \left( {\begin{array}{c}[a-1]\\ k-1\end{array}}\right) \) such that \(B'\not \in \mathcal {B}\) and it follows the last member of \(\mathcal {B}\) in colex order. Since \(\mathcal {A}\) contains all k-element subsets of \([a-1]\) and \(a\ge k+2\), we see that \(B'\) has at least two neighbors in \(\mathcal {A}-\{A\}\). This results in a graph on a larger number of edges than G and that is a colex-interval, a contradiction. \(\square \)

Proposition 20

If G is a layered graph on t vertices that is a colex-interval graph, then \(||G|| \le \frac{1}{4} t \log t (1+o(1))\).

Proof

Let G be in layer k, for some k. We can assume by Lemma 19 that G is a super-colex-interval.

Let x be the real number such that \(t = \left( {\begin{array}{c}x\\ k\end{array}}\right) \). Then \(G \subseteq Q_{a}\) for a satisfying \(a < x \le a+1\). Since G is in layer k of \(Q_a\), we have that \(k\le a\).

Case 1.   \(2k-2 \le x \le 2k+2 \)

In this case \( 2k-3 \le a \le 2k+2 \). Then \(t = \left( {\begin{array}{c}2k\\ k\end{array}}\right) C(1+o(1))\), where \(\frac{1}{4} \le C \le 4\). In particular, \(k= \frac{1}{2}\log t (1+o(1))\). The degree of any vertex of G from layer k is at most k, the degree of any vertex of G in layer \(k-1\) is at most \(a-k+1 \le (2k+2)- k+1 = k+3\). So \(||G|| \le (k+3) t/2 = \frac{1}{4}t\log t (1+o(1))\), as desired.

Case 2.   \(x> 2k+2\)

In particular, \(t = \left( {\begin{array}{c}x\\ k\end{array}}\right) > \left( {\begin{array}{c}2k\\ k\end{array}}\right) \). Let \(k'\) be the integer such that \(\left( {\begin{array}{c}2(k'-1)\\ (k'-1)\end{array}}\right) <t\le \left( {\begin{array}{c}2k'\\ k'\end{array}}\right) \). In particular \(k'> k\). Let \(G''\) be obtained by shifting G to layer \(k'\), i.e., \(V(G'') = \big \{v \cup \{a+1, \ldots , a+ (k'-k)\}: v\in V(G)\big \}\). We have that \(||G''||=||G||\) and \(|G''|=|G|=t\). Lemma 19 gives a graph \(G'\) that is super-colex-interval in layer \(k'\), and such that \(|G'|=t\) and \(||G'||\ge ||G''||\). Let \(x'\) be the real number such that \(t = \left( {\begin{array}{c}x'\\ k'\end{array}}\right) \). By the choice of \(k'\) we have \(\left( {\begin{array}{c}2k'-2\\ k'-1\end{array}}\right) < \left( {\begin{array}{c}x'\\ k'\end{array}}\right) \le \left( {\begin{array}{c}2k'\\ k'\end{array}}\right) \). The second inequality implies that \(x' \le 2k'\). We shall use the first inequality to show that \(x' \ge 2k'-2\). If not, then \(x' <2k'-2\) and \(t = \left( {\begin{array}{c}x'\\ k'\end{array}}\right)< \left( {\begin{array}{c}2k'-2\\ k'\end{array}}\right) < \left( {\begin{array}{c}2k'-2\\ k'-1\end{array}}\right) \), a contradiction. So, \(2k'-2 \le x' \le 2k'\) and we are done by Case 1 with k and x replaced by \(k'\) and \(x'\).

Case 3.  \(x< 2k-2\)

Recall that \(a<x\) and \(k\le a\), so in particular \(k\le a\le 2k-3\) in this case. Then consider a vertex-wise complement \(G''\) of G, i.e., an induced subgraph of \(Q_a\) with a vertex set \(\{[a] -v: v\in V(G)\}\). Then \(G''\) is in the layer \(k''= a+1-k\), it is isomorphic to G, so \(|G_1|=t\) and \(||G_1|| = e(t)\). Let y be the real number such that \(t = \left( {\begin{array}{c}y\\ k''\end{array}}\right) \). Assume as before that \(G''\) is a super-colex-interval. If \(y\ge 2k'' -2\), we are done by Cases 1 and 2. So assume that \(y<2k'' -2= 2a-2k\). Let \(b=2k-a\). Note that \(3\le b\le k \), \(2a-2k=a-b\) and \(k''=k-b+1\). Then

$$\begin{aligned} \left( {\begin{array}{c}a\\ k\end{array}}\right)<\left( {\begin{array}{c}x\\ k\end{array}}\right) = t = \left( {\begin{array}{c}y\\ k''\end{array}}\right) <\left( {\begin{array}{c}2a-2k\\ k''\end{array}}\right) =\left( {\begin{array}{c}a-b\\ k-b+1\end{array}}\right) . \end{aligned}$$

We have for any integers \(0<t\le s\) that \(\left( {\begin{array}{c}s+1\\ t+1\end{array}}\right) >\left( {\begin{array}{c}s\\ t\end{array}}\right) \). Thus,

$$\begin{aligned} \left( {\begin{array}{c}a\\ k\end{array}}\right)>\left( {\begin{array}{c}a-b+1\\ k-b+1\end{array}}\right) >\left( {\begin{array}{c}a-b\\ k-b+1\end{array}}\right) , \end{aligned}$$

a contradiction.

Therefore, \(||G|| \le \frac{1}{4} t \log t (1+o(1))\).

Note that if \(G'\) is a middle edge layer of a hypercube \(Q_n\) for some even n, then \(|G'| = t =\left( {\begin{array}{c}n\\ n/2\end{array}}\right) + \left( {\begin{array}{c}n\\ n/2-1\end{array}}\right) \) and \(||G'|| = \left( {\begin{array}{c}n\\ n/2\end{array}}\right) \frac{n}{2} = \frac{1}{4} t \log t (1+o(1))\). This implies that the largest size of a t-vertex layered graph is \(\frac{1}{4} t \log t (1+o(1))\), for any t expressible as the sum \(\left( {\begin{array}{c}n\\ n/2\end{array}}\right) + \left( {\begin{array}{c}n\\ n/2-1\end{array}}\right) \), for some even n. This shows that the upper bound in Proposition 20 is tight for infinitely many values of t. \(\square \)

7 Conclusions

The focus of this paper is to investigate the class of layered graphs and their Turán density in the hypercube. Recall that graphs that are not layered have positive Turán density in a hypercube. First, we developed a characterization of layered graphs in terms of very nice colorings, that is a convenient tool to analyze them. Then, we proved that any odd subdivision of a complete graph is layered and has zero Turán density. Similarly, we showed that any even subdivision of any complete bipartite graph is layered, and for such a k-subdivision, where k is divisible by 4 and \(k\ge 8\), it also has zero Turán density. This leaves first question:

Question 1.  Which graphs out of \(T_2(K_{t,t})\), \(T_4(K_{t,t})\), and \(T_6(K_{t,t})\) have zero Turán density for any t?

In addition, we showed that there are some cubical graphs that have girth 8 and that are not layered. In particular, there are graphs of girth 8 and of positive Turán density in the hypercube. This extends known results on graphs of girth 6 and leads to another question:

Question 2.  Are there graphs of arbitrarily large girth that are cubical but not layered?

As mentioned in the introduction, very recently this question was answered in the positive by Behague, Leader, Morrison, and Williams [10].

Since the density of layered graphs could be close to the density of general cubical graphs, it seems to be difficult to find such a graph using direct probabilistic methods. Nevertheless, the following question is of independent interest:

Question 3.  What is the largest number of edges in a layered graph on t vertices for any positive integer t?

Graham [28], see also Bollobás [13], Hart [31], and Chung, Füredi, Graham, and Seymour [17], determined the largest possible size of a cubical t-vertex graph by considering edge-cuts that are matching corresponding to color classes of nice colorings. Using Theorem 6 we have that any color class in a very nice coloring of a layered graph is a cut that is an induced matching. This property might allow one to determine the largest density of a layered graph exactly. Although we did not manage to find the largest number of edges in a t vertex layered graph even asymptotically, we believe that the answer should be \(\frac{1}{4} t \log t (1+o(1))\), i.e., half of the corresponding quantity in case of cubical graphs. This question is related to a class of classical isoperimetric questions since maximizing the number of edges in an induced subgraph of a regular graph is equivalent to minimizing the number of edges “leaving” this subgraph. Finally, we remark that it was proved by Haussler et al. [33, 34], that the largest number of edges in a subgraph of a hypercube induced by t vertices is at most t times the VC-dimension of the set family corresponding to the vertex set.

We made modest progress towards determining the extremal number of \(C_{10}\) in \(Q_n\), the remaining case for cycles in a hypercube for which it is not known whether the Turán density is zero or not. We proved that \(C_{10}\) definitely behaves differently from known cycles of zero Turán density in its extremal function, i.e., \(\textrm{ex}(Q_n, C_{10}) = \Omega (n2^n/ \log ^b n)\), \(b>0\), whereas for any other cycle C of zero Turán density \(\textrm{ex}(Q_n, C) = O(n^a2^n)\), for some \(a<1\). After this paper was accepted for publication, Grebennikov and Marciano [29] proved that \(C_{10}\) has positive Turán density on the hypercube.

We note that the bounds on extremal numbers for subdivisions we obtain could be improved using a more efficient embedding. In Appendix A, we recall a general approach introduced by Chung that might give better upper bounds for some 1-subdivisions. Finally, by explicitly constructing partite embeddings of subdivisions, we came up with a quite symmetric way to embed vertices of a hypercube in a layer of a larger hypercube such that adjacent vertices are embedded into pairs of vertices at a fixed distance. As it might be of independent interest, we present this construction in Appendix B.