A spectral extremal problem on non-bipartite triangle-free graphs

A theorem of Nosal and Nikiforov states that if $G$ is a triangle-free graph with $m$ edges, then $\lambda (G)\le \sqrt{m}$, where the equality holds if and only if $G$ is a complete bipartite graph. A well-known spectral conjecture of Bollob\'{a}s and Nikiforov [J. Combin. Theory Ser. B 97 (2007)] asserts that if $G$ is a $K_{r+1}$-free graph with $m$ edges, then $\lambda_1^2(G) + \lambda_2^2(G) \le (1-\frac{1}{r})2m$. Recently, Lin, Ning and Wu [Combin. Probab. Comput. 30 (2021)] confirmed the conjecture in the case $r=2$. Using this base case, they proved further that $\lambda (G)\le \sqrt{m-1}$ for every non-bipartite triangle-free graph $G$, with equality if and only if $m=5$ and $G=C_5$. Moreover, Zhai and Shu [Discrete Math. 345 (2022)] presented an improvement by showing $\lambda (G) \le \beta (m)$, where $\beta(m)$ is the largest root of $Z(x):=x^3-x^2-(m-2)x+m-3$. The equality in Zhai--Shu's result holds only if $m$ is odd and $G$ is obtained from the complete bipartite graph $K_{2,\frac{m-1}{2}}$ by subdividing exactly one edge. Motivated by this observation, Zhai and Shu proposed a question to find a sharp bound when $m$ is even. We shall solve this question by using a different method and characterize three kinds of spectral extremal graphs over all triangle-free non-bipartite graphs with even size. Our proof technique is mainly based on applying Cauchy interlacing theorem of eigenvalues of a graph, and with the aid of a triangle counting lemma in terms of both eigenvalues and the size of a graph.


Introduction
Let G be a simple graph with vertex set V (G) and edge set E(G).We usually write n and m for the number of vertices and edges, respectively.One of the main problems of algebraic graph theory is to determine the combinatorial properties of a graph that are reflected from the algebraic properties of its associated matrices.Let G be a simple graph on n vertices.The adjacency matrix of G is defined as A(G) = [a ij ] n×n where a ij = 1 if two vertices v i and v j are adjacent in G, and a ij = 0 otherwise.We say that G has eigenvalues λ 1 , λ 2 , . . ., λ n if these values are eigenvalues of the adjacency matrix A(G).Let λ(G) be the maximum value in absolute among all eigenvalues of G, which is known as the spectral radius of G.

The spectral extremal graph problems
A graph G is called F -free if it does not contain an isomorphic copy of F as a subgraph.Clearly, every bipartite graph is C 3 -free.The Turán number of a graph F is the maximum number of edges in an n-vertex F -free graph, and it is usually denoted by ex(n, F ).An F -free graph on n vertices with ex(n, F ) edges is called an extremal graph for F .As is known to all, the Mantel theorem (see, e.g., [2]) asserts that if G is a triangle-free graph on n vertices, then e(G) ≤ ⌊n 2 /4⌋, where the equality holds if and only if G is the balanced complete bipartite graph K ⌊ n 2 ⌋,⌈ n 2 ⌉ .There are numerous extensions and generalizations of Mantel's theorem; see [3,5].Especially, Turán (see, e.g., [2, pp. 294-301]) extended Mantel's theorem by showing that if G is a K r+1 -free graph on n vertices with maximum number of edges, then G is isomorphic to the graph T r (n), where T r (n) denotes the complete r-partite graph whose part sizes are as equal as possible.Each vertex part of T r (n) has size either ⌊ n r ⌋ or ⌈ n r ⌉.The graph T r (n) is usually called Turán's graph.Five alternative proofs of Turán's theorem are selected into THE BOOK1 [1, p. 285].Moreover, we refer the readers to the surveys [10,41].
Spectral extremal graph theory, with its connections and applications to numerous other fields, has enjoyed tremendous growth in the past few decades.There is a rich history on the study of bounding the eigenvalues of a graph in terms of various parameters.For example, one can refer to [4] for spectral radius and cliques, [35] for independence number and eigenvalues, [44,22] for eigenvalues of outerplanar and planar graphs, [8,51] for excluding friendship graph, and [45,52,12] for excluding minors.It is a traditional problem to bound the spectral radius of a graph.Let G be a graph on n vertices with m edges.It is natural to ask how large the spectral radius λ(G) may be.A well-known result states that λ(G) < √ 2m. ( This bound can be guaranteed by λ(G) 2 < n i=1 λ 2 i = Tr(A 2 (G)) = n i=1 d i = 2m.We recommend the readers to [13,14,32] for more extensions.
It is also a popular problem to study the extremal structure for graphs with given number of edges.For example, it is not difficult to show that if G has m edges, then G contains at most √ 2 3 m 3/2 triangles; see, e.g., [2, p. 304] and [7].In addition, it is an instrumental topic to study the interplay between these two problems mentioned-above.More precisely, one can investigate the largest eigenvalue of the adjacency matrix in a triangle-free graph with given number of edges 2 .Dating back to 1970, Nosal [40] and Nikiforov [32,35] independently obtained such a result.Theorem 1.1 (Nosal [40], Nikiforov [32,35]).Let G be a graph with m edges.If G is triangle-free, then where the equality holds if and only if G is a complete bipartite graph.
Inequality (3) impulsed the great interests of studying the maximum spectral radius for F -free graphs with given number of edges, see [32,35] for K r+1 -free graphs, [34,50,46] for C 4 -free graphs, [49] for K 2,r+1 -free graphs, [49,31] for C 5 -free or C 6 -free graphs, [29] for C 7 -free graphs, [43,9,26] for C △ 4 -free or C △ 5 -free graphs, where C △ k is a graph on k + 1 vertices obtained from C k and C 3 by sharing a common edge; see [37] for B k -free graphs, where B k denotes the book graph consisting of k triangles sharing a common edge, [21] for F 2 -free graphs with given number of edges, where F 2 is the friendship graph consisting of two triangles intersecting in a common vertex, [38,39] for counting the number of C 3 and C 4 .We refer the readers to the surveys [36,18] and references therein.
In particular, Bollobás and Nikiforov [4] posed the following nice conjecture.Conjecture 1.2 (Bollobás-Nikiforov, 2007).Let G be a K r+1 -free graph of order at least r + 1 with m edges.Then Recently, Lin, Ning and Wu [23] confirmed the base case r = 2; see, e.g., [37,17] for related results.Furthermore, the base case leads to Theorem 1.3 in next section.

The non-bipartite triangle-free graphs
The extremal graphs determined in Theorem 1.1 are the complete bipartite graphs.Excepting the largest extremal graphs, the second largest extremal graphs were extensively studied over the past years.In this paper, we will pay attention mainly to the spectral extremal problems for non-bipartite triangle-free graphs with given number of edges.Using the inequalities from majorization theory, Lin, Ning and Wu [23] confirmed the triangle case in Conjecture 1.2, and then they proved the following result.The upper bound in Theorem 1.3 is not sharp for m > 5. Motivated by this observation, Zhai and Shu [50] provided a further improvement on Theorem 1.3.For every integer m ≥ 3, we denote by β(m) the largest root of If m is odd, then we define SK 2, m−1 as the graph obtained from the complete bipartite graph K 2, m−1 2 by subdividing an edge; see Figure 1 The original proof of Zhai and Shu [50] for Theorem 1.4 is technical and based on the use of the Perron components.Subsequently, Li and Peng [19] provided an alternative proof by applying Cauchy interlacing theorem.We remark that lim m→∞ (β(m) − √ m − 2) = 0.In addition, Wang [46] improved Theorem 1.4 slightly by determining all the graphs with size m whenever it is a non-bipartite triangle-free graph satisfying λ(G) ≥ √ m − 2.

A question of Zhai and Shu
The upper bound in Theorem 1.4 could be attained only if m is odd, since the extremal graph SK 2, m−1 spectral extremal graph when m is even.Zhai and Shu in [50, Question 2.1] proposed the following question formally.
Question 1.5 (Zhai-Shu [50]).For even m, what is the extremal graph attaining the maximum spectral radius over all triangle-free non-bipartite graphs with m edges?
In this paper, we shall solve this question and determine the spectral extremal graphs.Although Question 1.5 seems to be another side of Theorem 1.4, we would like to point out that the even case is actually more difficult and different, and the original method is ineffective in this case.The construction of L m is natural.Nevertheless, it is not apparent to find Y m and T m .There are some analogous results that the extremal graphs depend on the parity of the size m in the literature.For example, the C 5 -free or C 6 -free spectral extremal graphs with m edges are determined in [49] when m is odd, and later in [31] when m is even.Moreover, the C △ 4 -free or C △ 5 -free spectral extremal graphs are determined in [43] for odd m, and subsequently in [9,26] for even m.In addition, the results of Nikiforov [33], Zhai and Wang [48] showed that the C 4 -free spectral extremal graphs with given order n also rely on the parity of n.In a nutshell, for large size m, there is a common phenomenon that the extremal graphs in two cases are extremely similar, that is, the extremal graph in the even case is always constructed from that in the odd case by handing an edge to a vertex with maximum degree.Surprisingly, the extremal graphs in our conclusion break down this common phenomenon and show a new structure of the extremal graphs.
Outline of the paper.In Section 2, we shall present some lemmas, which shows that the spectral radius of L m is smaller than that of Y m if m 3 ∈ N * , as well as that of T m if m−1 3 ∈ N * .Moreover, we will provide the estimations on both λ(L m ) and β(m).In Section 3, we will show some forbidden induced subgraphs, which helps us to characterize the local structure of the desired extremal graph.In Section 4, we present the proof of Theorem 1.7.Our proof of Theorem 1.7 is quite different from that of Theorem 1.4 in [50].The techniques used in our proof borrows some ideas from Lin, Ning and Wu [23] as well as Ning and Zhai [38].We shall apply Cauchy's interlacing theorem and a triangle counting result, which make full use of the information of all eigenvalues of a graph.In Section 5, we conclude this paper with some possible open problems for interested readers.
Notations.We shall follow the standard notation in [6] and consider only simple and undirected graphs.Let N (v) be the set of neighbors of a vertex v, and d(v) be the degree of v.For a subset S ⊆ V (G), we write e(S) for the number of edges with two endpoints in S, and N S (v) = N (v) ∩ S for the set of neighbors of v in S. Let K r+1 be the complete graph on r + 1 vertices, and K s,t be the complete bipartite graph with parts of sizes s and t.Let I k be an independent set on k vertices.We write C n and P n for the cycle and path on n vertices, respectively.Given graphs G and H, we write G ∪ H for the union of G and H.In other words, For simplicity, we write kG for the union of k copies of G.We denote by t(G) the number of triangles in G.

Preliminaries and outline of the proof
In this section, we will give the estimation on the spectral radius of L m .Note that L m exists whenever m is even, while Y m and T m are well-defined only if m (mod 3) is 0 or 1, respectively.We will show that Y m and T m have larger spectral radius than L m .In addition, we will introduce Cauchy interlacing theorem, a triangle counting result in terms of eigenvalues, and an operation of graphs which increases the spectral radius strictly.Before showing the proof of Theorem 1.7, we will illustrate the key ideas of our proof, and then we outline the main steps of the framework.

Bounds on the spectral radius of extremal graphs
By computations, we can obtain that λ(Y m ) is the largest root of Similarly, λ(T m ) is the largest root of and λ(L m ) is the largest root of the polynomial Moreover, we have λ(L 6 ) ≈ 2.1149, λ(L 8 ) ≈ 2.4938 and λ(L 10 ) ≈ 2.8424.
Proof.The case m ∈ {6, 8, 10} is straightforward.Next, we shall consider the case m ≥ 12.By a direct computation, it is easy to verify that Furthermore, we have Proof.We know from ( 6) that λ(Y m ) is the largest root of By calculations, we can verify that and for every m ≥ 38, we have Proof.Recall in (7) that λ(T m ) is the largest root of T (x).It is sufficient to prove that L(x) > xT (x) for every x ≥ 3. Upon computation, we can get Consequently, we have λ(L m ) < λ(T m ), as desired.
The next lemma provides a refinement on (5) for every m ≥ 62.
Lemma 2.4.Let m be even and m ≥ 62. Then The following lemma is referred to as the eigenvalue interlacing theorem, also known as Cauchy interlacing theorem, which states that the eigenvalues of a principal submatrix of a Hermitian matrix interlace those of the underlying matrix; see, e.g., [53, pp. 52-53] or [54, pp. 269-271].The eigenvalue interlacing theorem is a powerful tool to extremal combinatorics and plays a significant role in two recent breakthroughs [15,16].
Lemma 2.5 (Eigenvalue Interlacing Theorem).Let H be an n × n Hermitian matrix partitioned as Recall that t(G) denotes the number of triangles in G.It is well-known that the value of (i, j)-entry of A k (G) is equal to the number of walks of length k in G starting from vertex v i to v j .Since each triangle of G contributes 6 closed walks of length 3, we can count the number of triangles and obtain The forthcoming lemma could be regarded as a triangle spectral counting lemma in terms of both the eigenvalues and the size of a graph.This could be viewed as a useful variant of (9) by using n i=1 Lemma 2.6 (see [38]).Let G be a graph on n vertices with m edges.If For convenience, we introduce a function f (x), which will be frequently used in Section 3 to find the induced substructures that are forbidden in the extremal graph.Lemma 2.7.Let f (x) be a function given as The following lemma [47] is also needed in this paper, it provides an operation on a connected graph and increases the adjacency spectral radius strictly.

Proof overview
As promised, we will interpret the key ideas and steps of the proof of Theorem 1.7.First of all, we would like to make a comparison of the proofs of Theorem 1.3 and Theorem 1.4.The proof of Theorem 1.3 in [23] is short and succinct.It relies on the base case in Conjecture 1.2, which states that if G is a triangle-free graph with m ≥ 2 edges, then where the equality holds if and only if G is one of some specific bipartite graphs; see [23,37].
Combining the condition in Theorem 1.3, we know that if G is a triangle-free non-bipartite graph such that λ 1 (G) ≥ √ m − 1, then λ 2 (G) < 1.Such a bound on the second largest eigenvalue provides great convenience to characterize the local structure of G.For instance, combining λ 2 (G) < 1 with the Cauchy interlacing theorem, we obtain that C 5 is a shortest odd cycle of G.However, it is not sufficient to use (10) for the proof of Theorem 1.4.Indeed, if G satisfies further that λ(G) ≥ β(m), then we get λ 2 (G) < 2 only, since β(m) → √ m − 2 as m tends to infinity.Nevertheless, this bound is invalid for our purpose to describe the local structure of G.The original proof of Zhai and Shu [50] for Theorem 1.4 avoids the use of (10) and applies the Perron components.Thus it needs to make more careful structure analysis of the desired extremal graph.
To overcome the aforementioned obstacle, we will get rid of the use of (10), and then exploit the information of all eigenvalues of graphs, instead of the second largest eigenvalue merely.Our proof of Theorem 1.7 grows out from the original proof [23] of Theorem 1.3, which provided a method to find forbidden induced substructures.We will frequently use Cauchy interlacing theorem and the triangle counting result in Lemma 2.6.
The main steps of our proof can be outlined as below.It introduces the main ideas of the approach of this paper for treating the problem involving triangles.
♠ Assume that G is a spectral extremal graph with even size, that is, G is a nonbipartite triangle-free graph and attains the maximum spectral radius.First of all, we will show that G is connected and it does not contain the odd cycle C 2k+1 as an induced subgraph for every k ≥ 3. Consequently, C 5 is a shortest odd cycle in G.
♡ Let S be the set of vertices of a copy of C 5 in G.By using Lemma 2.5 and Lemma 2.6, we will find more forbidden substructures in the desired extremal graph; see, e.g., the graphs H 1 , H 2 , H 3 in Lemma 3.2.In this step, we will characterize and refine the local structure on the vertices around the cycle S.
♣ Using the information on the local structure of G, we will show that V (G) \ S has at most one vertex with distance two to S; see Claim 4.2.Moreover, there are at most three vertices of V (G) \ S with exactly one neighbor on S, and all these vertices are adjacent to a same vertex of S.
♢ Combining with the three steps above, we will determine the structure of G and show some possible graphs with large spectral radius.By comparing the polynomials of graphs, we will prove that G is isomorphic to Y m , T m or L m .
3 Some forbidden induced subgraphs In this section, we always assume that G is a non-bipartite triangle-free graph with even size m and G attains the maximal spectral radius.Since L m is triangle-free and non-bipartite, we get by Lemma 2.1 that On the other hand, we obtain from Theorem 1.4 and Lemma 2.4 that Our aim in this section is to determine some forbidden induced substructures of the extremal graph G.In this process, we need to exclude 16 induced substructures for our purpose.One of the main research directions in the proof is to show that G has at least one triangle, i.e., t(G) > 0, whenever the substructure forms an induced copy in G. Throwing away some tedious calculations, the main tools used in our proof attribute to Cauchy Interlacing Theorem (Lemma 2.5) and the triangle counting result (Lemma 2.6).Since C s is an induced copy in G, we know that A(C s ) is a principal submatrix of A(G).Lemma 2.5 implies that for every i ∈ {1, 2, . . ., s}, where λ i means the i-th largest eigenvalue.We next show that s = 5.For convenience, we write λ 1 ≥ λ 2 ≥ • • • ≥ λ n for eigenvalues of G in the non-increasing order.
Suppose on the contrary that C 7 is an induced odd cycle of G, then Evidently, we get Our goal is to get a contradiction by applying Lemma 2.6 and showing t(G) > 0. It is not sufficient to obtain t(G) > 0 by using the positive eigenvalues of C 7 only.Next, we are going to exploit the negative eigenvalues of C 7 .For i ∈ {4, 5, 6, 7}, we know that λ i (C 7 ) < 0. The Cauchy interlacing theorem yields To apply Lemma 2.7, we need to find the lower bounds on λ i for each i ∈ {n − 3, n − 2, n − 1, n}.We know from (11) that Similarly, we have Using (11) and ( 12), we have This is a contradiction.By the monotonicity of cos x, we can prove that C s can not be an induced subgraph of G for each odd integer s ≥ 7. Thus we get s = 5.
Using a similar method as in the proof of Lemma 3.1, we can prove the following lemmas, whose proofs are postponed to the Appendix.To avoid unnecessary calculations, we did not attempt to get the best bound on the size of G, and then we consider the case m ≥ 4.7×10 5 .

Proof of the main theorem
It is the time to show the proof of Theorem 1.7.
Proof of Theorem 1.7.Suppose that G is a non-bipartite triangle-free graph with m edges (m ≥ 4.7 × 10 5 is even) such that G attains the maximum spectral radius.Thus we have λ(G) ≥ λ(L m ) since L m is one of the triangle-free non-bipartite graphs.Our goal is First of all, we can see that G must be connected.Otherwise, we can choose G 1 and G 2 as two different components, where G 1 attains the spectral radius of G.By identifying two vertices from G 1 and G 2 , respectively, we get a new graph with larger spectral radius, which is a contradiction.By Lemma 3.1, we can draw the following claim.Proof.This claim is a consequence of Lemmas 3.2 and 3.4.Firstly, suppose on the contrary that V (G) \ S contains a vertex which has distance 3 to S. Let w 1 be such a vertex and P 4 = w 1 w 2 w 3 u 1 be a shortest path of length 3. Then w 2 can not be adjacent to any vertex of S. Since G is triangle-free, we know that neither w 3 u 2 nor w 3 u 5 can be an edge, and at least one of w 3 u 3 and w 3 u 4 is not an edge.If w 3 u 3 / ∈ E(G) and w 3 u 4 / ∈ E(G), then {w 2 , w 3 } ∪ S induces a copy of J 1 , contradicting with Lemma 3.4.If w 3 u 3 ∈ E(G) and w 3 u 4 / ∈ E(G), then {w 1 , w 2 , w 3 } ∪ (S \ {u 2 }) forms an induced copy of J 1 since w 1 w 3 , w 1 u i and w 2 u i are not edges of G, a contradiction.By symmetry, w 3 u 3 / ∈ E(G) and w 3 u 4 ∈ E(G) yield a contradiction similarly.
Secondly, suppose on the contrary that V (G)\S contains two vertices, say w 1 , w 2 , which have distance 2 to S. Let v 1 and v 2 be two vertices out of S such that w 1 ∼ v 1 ∼ S and w 2 ∼ v 2 ∼ S. Since J 1 can not be an induced copy of G and G is triangle-free, we know that we get a contradiction by Lemma 3.4.Thus, we get v 1 ̸ = v 2 .Without loss of generality, we may assume that N S (v 1 ) = {u 1 , u 3 }.By Lemma 3.2, G does not contain H 3 as an induced subgraph, we get N S (v 2 ) ̸ = {u 3 , u 5 } and N S (v 2 ) ̸ = {u 1 , u 4 }.By symmetry, we have either N S (v 2 ) = {u 2 , u 4 } or N S (v 2 ) = {u 1 , u 3 }.For the former case, since H 2 is not an induced subgraph of G by Lemma 3.2, we get v 1 v 2 ∈ E(G).If w 1 w 2 ∈ E(G), then G contains J 4 as an induced subgraph, which is a contradiction by Lemma 3.4.Thus w 1 w 2 / ∈ E(G).By Lemma 2.8, one can compare the Perron components of v 1 and v 2 , and then move w 1 and w 2 together, namely, either making w 1 adjacent to v 2 , or w 2 adjacent to v 1 .In this process, the resulting graph remains triangle-free and non-bipartite as well.However, it has larger spectral radius than G, which contradicts with the maximality of the spectral radius of G.For the latter case, i.e., N S (v 1 ) = N S (v 2 ) = {u 1 , u 3 }.Since J 3 is not an induced copy in G, a similar argument shows w 1 w 2 / ∈ E(G), and then it also leads to a contradiction.
By Claim 4.2, we shall partition the remaining proof in two cases, which are dependent on whether V (G) \ S contains a vertex with distance 2 to the 5-cycle S.
Case 1.Every vertex of V (G) \ S is adjacent a vertex of S. In this case, we have V (G) = S ∪ N (S).For convenience, we denote At the first glance, different vertices of V 1 can be joined to different vertices of S. By Lemma 3.3, G does not contain T 1 and T 2 as induced subgraphs, we obtain that V 1 is an independent set in G. Using Lemma 2.8, we can move all vertices of V 1 together such that all of them are adjacent to a same vertex of S, and get a new graph with larger spectral radius.Note that this process can keep the resulting graph being triangle-free and non-bipartite since V 1 is edge-less and S is still a copy of C 5 .By Lemma 3.2, H 1 can not an induced subgraph of G, then |V 1 | ≤ 3.
We can fix a vertex v ∈ N (S) and assume that N S (v) = {u 1 , u 3 }.For each w ∈ V (G) \ (S ∪ {v}), since G contains no triangles and no H 3 as an induced subgraph by Lemma 3.2, we know that N S (w) ̸ = {u 3 , u 5 } and N S (w)  Suppose that all vertices V 1 are adjacent to u 1 .Then there is no edge between V 1 and N 1,3 since G is triangle-free.Note that m = 5 + 2|N 1,3 | + |V 1 | is even, we get |V 1 | ∈ {1, 3}; see L m and G 4 in Figure 3.
Clearly, we can check that L(x) < F 4 (x) for each x ≥ 1, and so λ(G 4 ) < λ(L m ).Suppose that all vertices of V 1 are adjacent to u 2 .If there is no edge between V 1 and N 1,3 , then |V 1 | ∈ {1, 3} and G is isomorphic to G 2 or G 5 ; see Figure 3.By computations or Lemma 2.8, we can get λ(G) < λ(L m ); If there exists an edge between V 1 and N 1,3 , then we claim that V 1 and N 1,3 form a complete bipartite subgraph by Lemma 3.5.Indeed, Lemma 3.5 asserts that G does not contain L 1 as an induced subgraph.In other words, if v ∈ V 1 is a vertex which is adjacent to one vertex of N 1,3 , then v will be adjacent to all vertices of N 1,3 .Note that G does not contain L 2 as an induced subgraph, which means that other vertices of V 1 are also adjacent to all vertices of N 1,3 .Observe that m and G = Y m .By Lemma 2.2, we get λ(L m ) < λ(Y m ).Thus, Y m is the required extremal graph whenever m = 3t for some even t ∈ N * . If It is not hard to check that λ(G 6 ) < λ(L m ).Indeed, by calculation, we know that the largest roots of x 2 F 6 (x) and L(x) are located in ( . Moreover, we denote Clearly, we can verify that D( √ m − 3) < 0 and D( √ m − 2) < 0. Furthermore, one can prove that d dx D(x) > 0 for each x ≥ √ m − 3. Consequently, it leads to D(x) < 0 for every x ∈ ( √ m − 3, √ m − 2), and so L(x) < x 2 F 6 (x), which yields λ(G 6 ) < λ(L m ).Subcase 1.2.Without loss of generality, we may assume that N 2,4 ̸ = ∅ and N 5,2 = ∅, then . By Lemma 3.2, H 2 can not be an induced subgraph of G. Thus, N 1,3 and N 2,4 induce a complete bipartite subgraph in G. Now, we consider the vertices of V 1 .Recall that all vertices of V 1 are adjacent to a same vertex of S. By Lemma 3.3, G does not contain T 3 and T 4 as induced subgraphs.Then the vertices of V 1 can not be adjacent to u 1 , u 4 or u 5 .By Lemma 3.5, we know that L 3 and L 4 can not be induced subgraph of G. Thus, all vertices of V 1 can not be adjacent to u 2 or u 3 .To sum up, we get V 1 = ∅, and so The blow-up of a graph G is a new graph obtained from G by replacing each vertex v ∈ V (G) with an independent set I v , and for two vertices u, v ∈ V (G), we add all edges between I u and I v whenever uv ∈ E(G).It was proved in [23,37] that if G is a triangle-free graph with m ≥ 2 edges, then λ 2 1 (G) + λ 2 2 (G) ≤ m, where the equality holds if and only if G is a blow-up of a member of the family G = {P 2 ∪ K 1 , 2P 2 ∪ K 1 , P 4 ∪ K 1 , P 5 ∪ K 1 }.This result confirmed the base case of a conjecture of Bollobás and Nikiforov [4].Observe that all extremal graphs in this result are bipartite graphs.Therefore, it is possible to consider the maximum of λ 2 1 (G) + λ 2 2 (G) in which G is triangle-free and non-bipartite.The extremal problem was also studied for non-bipartite triangle-free graphs with given number of vertices.We write SK s,t for the graph obtained from the complete bipartite graph K s,t by subdividing an edge.In 2021, Lin, Ning and Wu [23] proved that if G is a non-bipartite triangle-free graph on n vertices, then

and equality holds if and only if
Comparing this result with Theorem 1.4, one can see that the extremal graphs with given order and size are extremely different although both of them are subdivisions of complete bipartite graphs.Roughly speaking, the former is nearly balanced, but the latter is exceedingly unbalanced.
Later, Li and Peng [20] extended (13) to the non-r-partite K r+1 -free graphs with n vertices.Notice that the extremal graph in (13) has many copies of C 5 .There is another way to extend (13) by considering the non-bipartite graphs on n vertices without any copy of {C 3 , C 5 , . . ., C 2k+1 } where k ≥ 2. This was done by Lin and Guo [24] as well as Li, Sun and Yu [17] independently.Subsequently, the corresponding spectral problem for graphs with m edges was studied in [42,19,28].However, the extremal graphs in this setting can be achieved only for odd m.Hence, we propose the following question for interested readers3 .Question 5.1.For even m, what is the extremal graph attaining the maximum spectral radius over all non-bipartite {C 3 , C 5 , . . ., C 2k+1 }-free graphs with m edges?
We write q(G) for the signless Laplacian spectral radius, i.e., the largest eigenvalue of the signless Laplacian matrix is the degree diagonal matrix and A(G) is the adjacency matrix.A theorem of He, Jin and Zhang [11] implies that if G is a triangle-free graph on n vertices, then q(G) ≤ n, with equality if and only if G is a complete bipartite graph (need not be balanced).This result can also be viewed as a spectral version of Mantel's theorem.It is worth mentioning that Liu, Miao and Xue [25] characterized the maximum signless Laplacian spectral radius among all non-bipartite triangle-free graphs with given order n and size m, respectively.Fortunately, the corresponding extremal graphs are independent of the parity of m.Soon after, they [30] also provided the extensions for graphs without any copy of {C 3 , C 5 , . . ., C 2k+1 }.
A Proofs of Lemmas 3.2, 3.3, 3.4 and 3.5 In the appendix, we shall provide the detailed proof of some lemmas in Section 3.
Proof of Lemma 3.2.Suppose on the contrary that G contains H i as an induced subgraph for some i ∈ {1, 2, 3}.To obtain a contradiction, we shall show that t(G) > 0 by using Lemma 2.6.The eigenvalues of graphs H 1 , H 2 and H 3 can be seen in Table 1.First of all, we consider the case that H 1 is an induced subgraph in G.The Cauchy interlacing theorem implies λ n−9+i (G) ≤ λ i (H 1 ) ≤ λ i (G) for every i ∈ {1, 2, . . ., 9}.We denote λ i = λ i (G) for short.Obviously, we have By Lemma 2.6, we obtain where the last inequality holds for m ≥ 188.This is a contradiction.Second, assume that H 2 is an induced subgraph of G. Then Cauchy interlacing theorem gives λ 2 ≥ 1, λ 3 ≥ 0.723 and λ 4 ≥ 0.414.Similarly, we get In where the last inequality holds for m ≥ 258, which is also a contradiction.Finally, if H 3 is an induced subgraph of G, then we get λ 2 ≥ 2 and λ 3 ≥ 0.642.Thus Similarly, we have − (m + 1.087)/2 < λ n−1 ≤ −2 and Combining Lemma 2.6 with λ 1 < √ m − 1.85, we get where the last inequality holds for m ≥ 162, which is a contradiction.
Using the similar method as in the proofs of Lemmas 3.1 and 3.2, we can prove Lemmas 3.3, 3.4 and 3.5 as well.For simplicity, we next present a brief sketch only.
Proof of Lemma 3.3.First of all, the eigenvalues of T 1 , . . ., T 4 can be given as below.
Similarly, we can get Using Lemma 2.6 and which is a contradiction.Thus, G does not contain T 1 as an induced subgraph.Suppose on the contrary that G contains T 2 as an induced subgraph.Then Lemma 2.5 implies λ 2 ≥ 1, λ 3 ≥ 1 and λ 4 ≥ 0.47.Thus, we have In addition, we have By Lemma 2.6 and a contradiction.So G does not contain T 2 as an induced subgraph.
Suppose on the contrary that T 3 is an induced subgraph of G. Using Lemma 2.5, we obtain λ 2 ≥ 1, λ 3 ≥ 0.723 and λ 4 ≥ 0.414.Then Similarly, we obtain Consequently, Lemma 2.6 and where the last inequality holds for m ≥ 276.This leads to a contradiction.Hence T 3 can not be an induced subgraph of G. Suppose on the contrary that T 4 is an induced subgraph of G. Applying Lemma 2.
Similarly, one can get a contradiction.Therefore T 4 can not be an induced subgraph of G.
The proofs of Lemmas 3.4 and 3.5 can proceed in a similar way.

Definition 1 . 6 ( 2 2 3 .
Spectral extremal graphs).Suppose that m ∈ 2N * .Let L m be the graph obtained from the subdivision SK 2, m−by hanging an edge on a vertex with the maximum degree.If m−3 3 is a positive integer, then we define Y m as the graph obtained from C 5 by blowing up a vertex to an independent set I m−3 3 on m−3 3 vertices, then adding a new vertex, and joining this vertex to all vertices of I m−3 If m−4 3 is a positive integer, then we write T m for the graph obtained from C 5 by blowing up two adjacent vertices to independent sets I m−4 3 and I 2 , respectively, where I m−4 3 and I 2 form a complete bipartite graph; see Figure 2.

Theorem 1 . 7 (
Main result).Let m be even and m ≥ 4.7 × 10 5 .Suppose that G is a triangle-free graph with m edges and G is non-bipartite.(a) If m = 3t for some t ∈ N * , then λ(G) ≤ λ(Y m ), with equality if and only if G = Y m .(b) If m = 3t + 1 for some t ∈ N * , then λ(G) ≤ λ(T m ), with equality if and only if G = T m .(c) If m = 3t + 2 for some t ∈ N * , then λ(G) ≤ λ(L m ), with equality if and only if G = L m .

Lemma 3 . 1 .
For any odd integer s ≥ 7, an extremal graph G does not contain C s as an induced cycle.Consequently, C 5 is a shortest odd cycle in G.Proof.Since G is non-bipartite, let s be the length of a shortest odd cycle in G. Since G is triangle-free, we have s ≥ 5.Moreover, a shortest odd cycle C s ⊆ G must be an induced odd cycle.It is well-known that the eigenvalues of C s are given as 2 cos 2πk s : k = 0, 1, . . ., s − 1 .In particular, we have Eigenvalues(C 7 ) = {2, 1.246, 1.246, −0.445, −0.445, −1.801, −1.801}.

Claim 4 . 1 .
C 5 is a shortest odd cycle in G.By Claim 4.1, we denote by S = {u 1 , u 2 , u 3 , u 4 , u 5 } the set of vertices of a copy of C 5 , where u i u i+1 ∈ E(G) and u 5 u 1 ∈ E(G).Let N (S) := ∪ u∈S N (u) \ S be the union of neighborhoods of vertices of S, and let d S (v) = |N (v) ∩ S| be the number of neighbors of v in the set S. Clearly, we have d S (v) ∈ {0, 1, 2} for every v ∈ V (G) \ S. Otherwise, if d S (v) ≥ 3, then one can find a triangle immediately, a contradiction.

Claim 4 . 2 .
V (G) \ S does not contain a vertex with distance 3 to S, and V (G) \ S has at most one vertex with distance 2 to S.
Note that G has no induced copy of H 3 , then at least one of the sets N 2,4 and N 5,2 is empty.Subcase 1.1.If both N 2,4 = ∅ and N 5,2 = ∅, then V 2 = N 1,3 and V (G) = S ∪V 1 ∪N 1,3 .By Lemma 3.3, T 3 and T 4 can not be induced subgraphs of G. Hence, all vertices of V 1 are adjacent to the vertex u 1 or u 2 by symmetry.Next, we will show that |V 1 | ∈ {1, 3}, and then we prove that V 1 and N 1,3 form a complete bipartite graph or an empty graph.
and |B| = b.Then we observe that G is isomorphic to the subdivision of the complete bipartite graph K a,b by subdividing the edge u 1 u 4 of K a,b .Note that m = ab + 1 and a, b ≥ 3 are odd integers.Without loss of generality, we may assume that a ≥ b.If b = 3, then m = 3a + 1 for some a ∈ N * .In this case, we get G = T m .Invoking Lemma 2.3, we have λ(L m ) < λ(T m ) and thus T m is the desired extremal graph.If b ≥ 5, then m = ab + 1 and λ(SK a,b ) is the largest root of