1 Introduction

Let \(G=(V,E)\) be a simple connected graph with vertex set \(V(G)\) and edge set \(E(G)\). Its order is \(|V(G)|\), denoted by \(n(G)\) (or n for short), and its size is \(|E(G)|\), denoted by \(m(G)\) (or m for short). For a vertex \(v \in V(G)\), let \(N(v)\) be the set of all neighbors of v in G and let \(d(v)=|N(v)|\) be the degree of v. Particularly, denote by \(\Delta(G)\) the maximum degree of G. A pendent vertex is a vertex with degree one. The diameter of a connected graph G, denoted by \(d(G)\), is the maximum distance among all pairs of vertices in G. Let \(S_{n}\) and \(P_{n}\) be the star and the path of order n, respectively. Let \(S^{k}_{a,b}\) be the tree of order n obtained from two stars \(S_{a+1}\), \(S_{b+1}\) by joining a path of length k between their central vertices (see Figure 2). For all other notions and definitions, not given here, see, for example, [1] or [2] (for graph spectra).

Let \(A(G)\) and \(D(G)\) be the adjacency matrix and the diagonal matrix of vertex degrees of G, respectively. The matrix \(L(G)=D(G)-A(G)\) is called Laplacian matrix of G. The Laplacian matrix is an important topic in the theory of graph spectra. We use the notation \(I_{n}\) for the identity matrix of order n and denote by \(\phi(G, x) = \det(xI_{n}-L(G))\) the Laplacian characteristic polynomial of G. It is well known that \(L(G)\) is positive semidefinite symmetric and singular. Denote its eigenvalues by \(\mu_{1}(G) \geq\mu_{2}(G)\geq\cdots\geq \mu_{n}(G)\) (or simply \(\mu_{1} \geq\mu_{2} \geq\cdots\geq \mu_{n}\) sometimes for convenience) which are always enumerated in non-increasing order and repeated according to their multiplicity. Note that each row sum of \(L(G)\) is 0 and, therefore, \(\mu_{n}(G)=0\). Fiedler [3] showed that the second smallest eigenvalue \(\mu_{n-1}(G)\) of \(L(G)\) is 0 if and only if G is disconnected. Thus the second smallest eigenvalue of \(L(G)\) is popularly known as the algebraic connectivity of G. The largest eigenvalue \(\mu_{1}(G)\) of \(L(G)\) is usually called the Laplacian spectral radius of the graph G. Recently, some of the research has been focused on \(\mu_{1}\), \(\mu_{2}\) or \(u_{n-1}\) (see [39]).

Let \(S_{k}(G)= \sum_{i=1}^{i=k}\mu_{i}(G)\) be the sum of the k largest Laplacian eigenvalues of G. Brouwer conjectured that \(S_{k}(G) \leq m(G)+ \binom{k+1}{2}\) for \(k=1,2,\ldots, n\). The conjecture is still open, but some advances on the conjecture have been achieved (see [1014]). Specially, for \(k = 2\), Haemers et al. [12] proved that \(S_{2}(G) \leq m(G)+3\) for any graph G. When G is a tree, Fritscher et al. [15] improved this bound by giving \(S_{2}(T) \leq m(T)+3-\frac{2}{n(T)}\), which implies that Haemers’ bound is always not attainable for trees. Therefore, it is interesting to determine which tree has maximal value of \(S_{2}(T)\) among all trees of order n. Guan et al. [11] proved that \(S_{2}(T)\leq S_{2}(T^{1}_{\lceil\frac{n-2}{2}\rceil, \lfloor\frac{n-2}{2} \rfloor})\) for any tree of order \(n \geq4\), and the equality holds if and only if \(T \cong T^{1}_{\lceil\frac {n-2}{2}\rceil, \lfloor\frac{n-2}{2} \rfloor}\). For any graph G of order n with m edges, note that \(\mu_{1}(G)\leq n(G)\). Then Haemers’ bound is clearly not attainable when \(2n(G)< m(G)+3\). For \(m(G)+3 \leq2n(G)\), Guan et al. [11] showed that \(S_{2}(G_{m,n})=m(G_{m,n})+3\), where \(G_{m,n}\) is a graph of order n size m which has \(m-n+1\) triangles with a common edge and \(2n-m-3\) pendent edges incident with one end vertex of the common edge (\(G_{n+1,n}\) is illustrated in Figure 1). This indicates that Haemers’ bound is always sharp for connected graphs (\(m \leq2n-3\)) other than trees. The following conjecture on the uniqueness of the extremal graph is also presented in [11].

Figure 1
figure 1

\(\pmb{G_{n+1,n}}\) . \(G_{m,n}\) is a graph of order n with m edges which has \(m-n+1\) triangles with a common edge and \(2n-m-3\) pendent edges incident with one end vertex of the common edge.

Conjecture 1.1

[11]

Among all connected graphs of order n with m edges (\(n \leq m\leq2n -3\)), \(G_{m,n}\) is the unique graph with maximal value of \(S_{2}(G)\), that is, \(S_{2}(G_{m,n})=m(G_{m,n})+3\).

In this paper, we confirm Conjecture 1.1 with \(m=n\).

2 Preliminaries

In this section, we present some lemmas which will be useful in the subsequent sections. For \(\mu_{1}(G)\), the following results are well known.

Lemma 2.1

Let G be a connected graph of order n, \(d_{i}=d(v_{i})\) and \(m_{i}=\sum_{v_{j} \in N(v_{i})}d_{j}/d_{i}\). Then

  1. (1)

    [4] \(\mu_{1}(G) \leq n(G)\) with equality if and only if the complement of G is disconnected;

  2. (2)

    [8] \(\mu_{1}(G) \leq \max\{d_{i}+m_{i}|v_{i} \in V(G)\}\).

Lemma 2.2

[7]

Let G be a connected graph of order \(n \geq4\) with m edges. Then

$$\mu_{1}(G) < \max \biggl\{ \Delta(G), m-\frac{n-1}{2} \biggr\} +2. $$

Lemma 2.3

[9]

Let T be a tree of order n with \(d(T)\geq3\). Then \(\mu_{1}(T) < n-0.5\).

Lemma 2.4

Let T be a tree of order n with \(d(T)\geq4\). Then \(\mu_{1}(T) < n-1\).

Proof

For any tree T of order n with \(d(T)\geq4\), it follows that \(n \geq5\) and \(\Delta(T)\leq n-3\). That is, \(\Delta(T)+2 \leq n-1\) and \(m-\frac{n-1}{2} +2=\frac{n-1}{2} +2 \leq n-1\). Then the result follows from Lemma 2.2. □

The following theorem from matrix theory plays a key role in our proofs. We denote the eigenvalues of a symmetric matrix M of order n by \(\lambda_{1}(M)\geq\lambda_{2}(M)\geq\cdots \geq\lambda_{n}(M)\).

Theorem 2.5

[16]

Let A and B be two real symmetric matrices of size n. Then, for any \(1\leq k \leq n\),

$$\sum_{i=1}^{k}\lambda_{i}(A+B) \leq\sum_{i=1}^{k}\lambda_{i}(A)+ \sum_{i=1}^{k}\lambda_{i}(B). $$

From Theorem 2.5, the following lemma is immediate.

Lemma 2.6

Let \(G_{1}, \ldots, G_{r}\) be some edge disjoint graphs. Then, for any k,

$$S_{k}(G_{1}\cup\cdots\cup G_{r})\leq \sum _{i=1}^{r}S_{k}(G_{i}). $$

The following lemma can be found in [2] and is well known as the interlacing theorem of Laplacian eigenvalues.

Lemma 2.7

[2]

Let G be a graph of order n and let \(G^{\prime}\) be the graph obtained from G by inserting a new edge into G. Then the Laplacian eigenvalues of G and \(G^{\prime}\) interlace, that is,

$$\mu_{1}\bigl(G^{\prime}\bigr) \geq\mu_{1}(G) \geq\cdots \mu_{n}\bigl(G^{\prime}\bigr) \geq\mu_{n}(G)=0. $$

Lemma 2.8

[2]

Let A be a symmetric matrix of order n with eigenvalues \(\lambda _{1} \geq\lambda_{2} \geq\cdots\geq\lambda_{n}\) and B be a principal submatrix of A of order m with eigenvalues \(\mu_{1} \geq\mu_{2} \geq\cdots\geq\mu_{m}\). Then the eigenvalues of B interlace the eigenvalues of A, that is, \(\lambda_{i} \geq\mu_{i} \geq\lambda _{n-m+i}\) for \(i=1, \ldots, m\). Specially, for \(v \in V(G)\), let \(L_{v}(G)\) be the principal submatrix of \(L(G)\) formed by deleting the row and column corresponding to vertex v, then the eigenvalues of \(L_{v}(G)\) interlace the eigenvalues of \(L(G)\).

Lemma 2.9

For any tree T of order n, if there exists an edge \(e\in E(T)\) such that \(\min\{e(T_{1}), e(T_{2})\} \geq2\) and \(\min\{d(T_{1}), d(T_{2})\} \geq3\) or \(\max\{d(T_{1}), d(T_{2})\} \geq4\), then \(S_{2}(T) < n(T)+1\), where \(T_{1}\), \(T_{2}\) are the two components of \(T-e\).

Proof

Let \(T-e=T_{1} \cup T_{2}\). By Lemma 2.6, it suffices to show that \(S_{2}(T_{1} \cup T_{2}) < n(T)-1\). If \(\mu_{1}(T)= \mu_{1}(T_{1})\) and \(\mu_{2}(T)= \mu_{2}(T_{1})\) (or \(\mu_{1}(T)= \mu_{1}(T_{2})\) and \(\mu_{2}(T)= \mu_{2}(T_{2})\)), then the result follows since \(S_{2}(T_{1} \cup T_{2})=S_{2}(T_{i}) < m(T_{i})+3 \leq m(T)=n(T)-1\) for \(i=1, 2\). In what follows, we assume that \(S_{2}(T_{1} \cup T_{2})=\mu_{1}(T_{1})+\mu_{1}(T_{2})\). If \(\min\{d(T_{1}), d(T_{2})\} \geq3\), then Lemma 2.3 implies that \(S_{2}(T_{1} \cup T_{2}) < (n(T_{1})-0.5)+ (n(T_{2})-0.5) = n(T)-1\). If \(\max\{d(T_{1}), d(T_{2})\} \geq4\), say \(d(T_{2}) \geq4\), then Lemmas 2.1 and 2.4 imply that \(S_{2}(T_{1} \cup T_{2}) < n(T_{1})+ (n(T_{2})-1)=n(T)-1\). This completes the proof. □

Lemma 2.10

For any tree T of order n with \(d(T)=5\), \(S_{2}(T)< n(T)+1\).

Proof

Without loss of generality, we assume that \(v_{1}v_{2}v_{3}v_{4}v_{5}v_{6}\) is a path of length 5 in T. We now consider the following three cases.

Case 1. \(\min\{d(v_{3}), d(v_{4})\} \geq3\).

Let \(T_{1}\), \(T_{2}\) be the two components of \(T-v_{3}v_{4}\). Then the result follows from Lemma 2.9.

Case 2. \(d (v_{3}) = d (v_{4}) = 2\).

Note that \(d(T)=5\). Then T is isomorphic to \(S^{3}_{a,b}\) (see Figure 2), where \(a, b \geq1\) and \(a+b+4=n\). By an elementary calculation, we have \(\phi(S^{3}_{a,b},\lambda)=\lambda(\lambda-1)^{n-5}f_{1}(\lambda)\), where \(f_{1}(\lambda)= \lambda^{4}-(n+3)\lambda^{3}+(5n+ab-4)\lambda^{2}-(6n+3ab-10)\lambda+n\). Denoted by \(\lambda_{1} \geq\lambda_{2} \geq\lambda_{3} \geq \lambda_{4}>0\) are the four roots of \(f_{1}(\lambda)=0\). Then we have \(\lambda_{1} + \lambda_{2} + \lambda_{3} + \lambda_{4}=n+3\) since \(\sum_{i=1}^{i=n}\mu_{i}=2m\). Note that \(S^{3}_{a,b}\) contains \(P_{6}\) as a subgraph. Then Lemma 2.7 implies that \(\lambda_{3} \geq\mu_{3}(P_{6})=2\). Thus, \(S_{2}(T)=\lambda_{1} + \lambda_{2}=n+3-(\lambda_{3} + \lambda_{4})< n+3-\lambda_{3}< n-1\), as desired.

Figure 2
figure 2

Two trees of order n .

Case 3. \(d(v_{3}) \geq3\) and \(d(v_{4}) = 2\) (or \(d(v_{4}) \geq3\) and \(d(v_{3}) = 2\)).

Without loss of generality, we assume that \(d(v_{3}) \geq3\) and \(d(v_{4}) = 2\). If \(d(v_{2}) \geq3\), let \(T-v_{2}v_{3}= T_{1} \cup T_{2}\); if there is \(P_{3}=uvv_{3}\) attached to \(v_{3}\), let \(T-v_{3}v_{4}= T_{1} \cup T_{2}\), where \(u, v \neq v_{i}\) (\(i=1,2,\ldots,6\)). Then the result follows from Lemma 2.9. We now assume that \(d(v_{2})=d(v_{4})=2\) and all the neighbors of \(v_{3}\) except for \(v_{2}\) and \(v_{4}\) are pendent vertices. That is, T is isomorphic to \(H_{a,b}\), where \(H_{a,b}\) (see Figure 2) is the tree of order n obtained from \(v_{1}v_{2}v_{3}v_{4}v_{5}v_{6}\) by attaching a and \(b-1\) pendent vertices to \(v_{3}\) and \(v_{5}\), respectively, where \(a, b \geq1\) and \(a+b+5=n\). Note that the matrix \(1\cdot I_{n}-L(H_{a,b})\) has a and b different identical rows. Then the multiplicity of eigenvalue 1 is at least \(n-7\). Let \(\lambda_{1} \geq\lambda_{2} \geq\lambda_{3} \geq \lambda_{4}\geq\lambda_{5} \geq\lambda_{6} > \lambda_{7}=0\) be the other seven eigenvalues. Then \(\lambda_{1} + \lambda_{2} + \lambda_{3} + \lambda_{4}+\lambda_{5} + \lambda_{6}+ \lambda_{7}=n+5\) since \(\sum_{i=1}^{i=n}\mu_{i}=2m\). For \(a, b\geq 2\), \(H_{a,b}\) contains \(H_{2,2}\) as a subgraph. Then by Lemma 2.7 we have \(\lambda_{3} \geq\mu_{3}(H_{2,2})=2.44\) and \(\lambda_{4} \geq\mu_{4}(H_{2,2})=1.59\). Therefore, \(S_{2}(T)=\lambda_{1} + \lambda_{2} < n+5-(\lambda_{3}+\lambda_{4})< n+1\), as required. If \(a=1\), then by Lemmas 2.1 and 2.8 we have \(\mu_{1}(H_{1,b}) \leq(n-5)+\frac{n-4}{n-5}\) and \(\mu_{2}(H_{1,b}) \leq\mu_{1}(L_{v_{5}}(H_{1,b}))=4.26\). That is, \(S_{2}(T)=S_{2}(H_{1,b})=\mu_{1}(H_{1,b})+\mu_{2}(H_{1,b})< n+1\), as required. Similarly, if \(b=1\), then by Lemmas 2.1 and 2.8 we have \(\mu_{1}(H_{a,1}) \leq(n-4)+\frac{n-2}{n-4}\) and \(\mu_{2}(H_{a,1}) \leq\mu_{1}(L_{v_{3}}(H_{a,1}))=3.0\). It follows that \(S_{2}(T)=S_{2}(H_{a,1})=\mu_{1}(H_{a,1})+\mu _{2}(H_{a,1})< n+1\), as required.

From the discussion above, the proof is completed. □

Lemma 2.11

Let T be a tree of order n with \(d(T)\geq6\). Then \(S_{2}(T)< n(T)+1\).

Proof

We now consider the following two cases.

Case 1. \(d(T)\geq7\).

Let \(v_{1}v_{2}v_{3}v_{4}v_{5}v_{6}v_{7}v_{8}\) be a path of length 7 in T and \(T-v_{4}v_{5}=T_{1} \cup T_{2}\). Then the result follows from Lemma 2.9.

Case 2. \(d(T)=6\).

If \(T= P_{7}\), then the result follows since \(S_{2}(P_{7}) < 8\). If \(T\neq P_{7}\), let \(v_{1}v_{2}v_{3}v_{4}v_{5}v_{6}v_{7}\) be a path of length 6 in T. If \(d(v_{4})\geq3\), let \(T-v_{3}v_{4}=T_{1} \cup T_{2}\); if \(d(v_{3})\geq3\) (or \(d(v_{5})\geq3\)), let \(T-v_{3}v_{4}=T_{1} \cup T_{2}\) (or \(T-v_{4}v_{5}=T_{1} \cup T_{2}\)); if \(d(v_{2})\geq3\) (or \(d(v_{6})\geq3\)), let \(T-v_{2}v_{3}=T_{1} \cup T_{2}\) (or \(T-v_{5}v_{6}=T_{1} \cup T_{2}\)). In each of the above cases, by Lemma 2.9, we have \(S_{2}(T)< n(T)+1\). This completes the proof. □

A firefly graph \(F_{s,t,n-2s-2t-1}\) (\(s \geq0\), \(t \geq0\) and \(n-2s-2t-1 \geq0\)) is a graph with n vertices that consists of s triangles, t pendent paths of length 2 and \(n-2s-2t-1\) pendent edges, sharing a common vertex. An example of a firefly graph \(F_{2,3,4}\) is illustrated in Figure 3. Clearly \(F_{0,0,n-1} \cong S_{n}\) and \(F_{1,0,n-3} \cong G_{n,n}\).

Figure 3
figure 3

An example of firefly graph.

Lemma 2.12

[6] The second largest Laplacian eigenvalue of \(F_{1, t, n-2t-3}\) satisfies \(\mu_{2}(F_{1, t, n-2t-3})=3\).

Note that for \(t \geq1\), the complement of \(F_{1, t, n-2t-3}\) is connected. Hence Lemma 2.1 implies that \(\mu_{1}(F_{1, t, n-2t-3})< n(F_{1, t, n-2t-3})\). This together with Lemma 2.12 implies the following lemma.

Lemma 2.13

For \(t \geq1\), \(S_{2}(F_{1, t, n-2t-3}) < n(F_{1, t, n-2t-3})+3\).

3 Main result

A unicyclic graph is a connected graph whose number of edges m is equal to the number of vertices n. It is easy to see that each unicyclic graph can be obtained by attaching rooted trees to the vertices of a cycle \(C_{k}\) for some k. Thus if \(R_{1},\ldots, R_{k}\) are k rooted trees (of orders \(n_{1},\ldots, n_{k}\), say), then we adopt the notation \(U(R_{1},\ldots, R_{k})\) to denote the unicyclic graph G (of order \(n=n_{1}+\cdots+n_{k}\)) obtained by attaching the rooted tree \(R_{i}\) to the vertex \(v_{i}\) of a cycle \(C_{k}=v_{1}v_{2} \cdots v_{k}v_{1}\) (i.e., by identifying the root of \(R_{i}\) with the vertex \(v_{i}\) for \(i=1,\ldots, k\)). Denote by \(e(v_{i})\) the maximum distance between \(v_{i}\) and any vertex of \(R_{i}\). In the special case when \(R_{i}\) is a rooted star \(K_{1,a_{i}}\) with the center of the star as its root (that is, \(e(v_{i})=1\)), we will simplify the notation by replacing \(R_{i}\) by the number \(a_{i}\).

The following lemma is immediate from Lemmas 2.6, 2.10 and 2.11.

Lemma 3.1

For any unicyclic graph G of order n with m edges, if there exists an edge \(e\in E(G)\) such that \(G-e\) is a tree with \(d(G-e) \geq5\), then \(S_{2}(G)< m(G)+3\).

Let \(uvwu\) be a triangle and \(T_{a,b,c}\) be the graph obtained by attaching a, b, c pendent vertices to u, v, w, respectively, where \(a+b+c=n-3\) and \(a \geq b \geq c \geq0\). Note that \(T_{n-3,0,0} \cong G_{n,n}\). Denote by \(Q_{a,b}\) the graph obtained by attaching a and b pendent vertices to two non-adjacent vertices of a quadrangle, respectively, where \(a+b=n-4\) and \(a \geq b \geq0\). \(T_{a,b,c}\) and \(Q_{a,b}\) are illustrated in Figure 4.

Figure 4
figure 4

Two unicyclic graphs of order n . \(T_{a,b,c}\) is a unicyclic graph of order n obtained by attaching a, b, c pendent vertices to three vertices of a triangle \(uvw\), respectively, and \(Q_{a,b}\) is a unicyclic graph of order n obtained by attaching a and b pendent vertices to two non-adjacent vertices of a quadrangle, respectively.

Lemma 3.2

For \(T_{a,b,c}\), \(S_{2}(T_{a,b,c}) \leq m(T_{a,b,c})+3\) with equality if and only if \(a=n-3\) (that is, \(T_{a,b,c} \cong G_{n,n}\)).

Proof

Note that the matrix \(1\cdot I_{n}-L(T_{a,b,c})\) has a, b and c different identical rows. So the multiplicity of eigenvalue 1 is at least \(n-6\). Let \(\lambda_{1} \geq\lambda_{2} \geq\lambda_{3} \geq\lambda_{4} \geq \lambda_{5} > \lambda_{6}=0\) be the other six eigenvalues of \(L(T_{a,b,c})\). Then we have \(\lambda_{1} + \lambda_{2} + \lambda_{3} + \lambda_{4}+\lambda_{5} =n+6\) since \(\sum_{i=1}^{i=n}\mu_{i}=2m(G)\). For \(c \geq2\), \(T_{a,b,c}\) contains \(T_{2,2,2}\) as a subgraph. Then by Lemma 2.7 we have \(\lambda_{3} \geq\mu_{3}(T_{2,2,2})=3.0\). Therefore, \(S_{2}(T_{a,b,c})=\lambda_{1} + \lambda_{2} =n+6-( \lambda_{3} + \lambda_{4}+\lambda_{5})< n+6-\lambda_{3} \leq n+3 = m(T_{a,b,c})+3\), as required. For \(c=1\) and \(b \geq4\), \(T_{a,b,c}\) contains \(T_{4,4,1}\) as a subgraph. Then by Lemma 2.7 we have \(\lambda_{3} \geq\mu_{3}(T_{4,4,1})=3.0\). That is, \(S_{2}(T_{a,b,1}) = n+6-( \lambda_{3} + \lambda_{4}+\lambda _{5})< n+6-\lambda_{3} \leq n+3 = m(T_{a,b,c})+3\), as required. If \(c=1\) and \(b=3\), then by Lemmas 2.1 and 2.8, we have \(\mu_{1}(T_{a,3,1}) \leq n-4+\frac{6}{n-5}\) and \(\mu_{2}(T_{a,3,1}) \leq\mu_{1}(L_{u}(T_{a,3,1}))=5.88\). It follows that \(S_{2}(T_{a,3,1})= \mu_{1}(T_{a,3,1})+ \mu_{2}(T_{a,3,1}) < m(T_{a,3,1})+3\), as required. If \(c=1\) and \(b=2\), then by Lemmas 2.1 and 2.8, we have \(\mu_{1}(T_{a,2,1}) \leq n-3+\frac {5}{n-4}\) and \(\mu_{2}(T_{a,2,1}) \leq\mu_{1}(L_{u}(T_{a,2,1}))=5.05\). That is, \(S_{2}(T_{a,2,1})= \mu_{1}(T_{a,2,1})+ \mu_{2}(T_{a,2,1}) < m(T_{a,2,1})+3\) for \(n \geq10\) (that is, \(a \geq4\)), as required. A direct calculation shows that \(S_{2}(T_{3,2,1}) < m(T_{3,2,1})+3\) (or \(S_{2}(T_{2,2,1}) < m(T_{2,2,1})+3\)). Similarly, if \(c=1\) and \(b=1\), then by Lemmas 2.1 and 2.8, we have \(\mu_{1}(T_{a,1,1}) \leq n-2+\frac{4}{n-3}\) and \(\mu_{2}(T_{a,1,1}) \leq\mu _{1}(L_{u}(T_{a,1,1}))=4.30\). That is, \(S_{2}(T_{a,1,1})= \mu _{1}(T_{a,1,1})+ \mu_{2}(T_{a,1,1} )< m(T_{a,1,1})+3\), for \(n \geq9\) (that is, \(a \geq4\)), as required. A direct calculation shows that \(S_{2}(T_{3,1,1}) < m(T_{3,1,1})+3\) (or \(S_{2}(T_{2,1,1}) < m(T_{2,1,1})+3\) or \(S_{2}(T_{1,1,1}) < m(T_{1,1,1})+3\)). Next, we assume \(c=0\). By an elementary calculation, we have \(\phi (T_{a,b,0},\lambda)=\lambda(\lambda-1)^{n-5}f_{2}(\lambda)\), where \(f_{2}(\lambda)= \lambda^{4}-(n+5)\lambda^{3}+(5n+ab+7)\lambda ^{2}-(7n+2ab+3)\lambda+3n\). Let \(x_{1}\geq x_{2} \geq x_{3}\geq x_{4}\) be the roots of \(f_{2}(\lambda)=0\). Then

$$\begin{aligned}& x_{1}+ x_{2} + x_{3}+ x_{4}=n+5, \end{aligned}$$
(3.1)
$$\begin{aligned}& x_{1}x_{2}+x_{1}x_{3}+x_{1}x_{4}+x_{2}x_{3}+x_{2}x_{4}+x_{3}x_{4}=5n+ab+7, \end{aligned}$$
(3.2)
$$\begin{aligned}& x_{2}x_{3}x_{4}+x_{1}x_{3}x_{4}+x_{1}x_{2}x_{4}+x_{1}x_{2}x_{3}=7n+2ab+3. \end{aligned}$$
(3.3)

If

$$ x_{1}+ x_{2}=n+3, $$
(3.4)

then, by (3.1), we have

$$ x_{3}+ x_{4}=2. $$
(3.5)

From (3.2)-(3.5) it follows that

$$\begin{aligned}& x_{1}x_{2}+x_{3}x_{4}=3n+ab+1, \end{aligned}$$
(3.6)
$$\begin{aligned}& (n+3)x_{3}x_{4}+2x_{1}x_{2}=7n+2ab+3. \end{aligned}$$
(3.7)

By (3.6) and (3.7), we have

$$\begin{aligned}& x_{3}x_{4}=1. \end{aligned}$$
(3.8)

Combining (3.5) and (3.8), we have

$$ x_{3}=x_{4}=1. $$
(3.9)

Then \(f_{2}(1)=-2ab=0\), which implies that \(b=0\). Therefore, if \(b \geq 1\), then \(S_{2}(T_{a,b,0}) < m(T_{a,b,0})+3\). A direct calculation shows that \(S_{2}(T_{n-3,0,0}) = m(T_{n-3,0,0})+3\). This completes the proof. □

Lemma 3.3

For \(Q_{a,b}\), \(S_{2}(Q_{a,b}) < m(Q_{a,b})+3\).

Proof

By a direct calculation, we have \(\phi(Q_{a, b},\lambda)=\lambda(\lambda-1)^{n-6}f_{3}(\lambda)\), where \(f_{3}(\lambda)=(\lambda-2)(\lambda^{4}-(n+4)\lambda ^{3}+(5n+ab+1)\lambda^{2}-(6n+2ab-2)\lambda+2n)\). Let \(\lambda_{1} \geq\lambda_{2} \geq\lambda_{3} \geq\lambda_{4}\geq \lambda_{5}>0 \) be the five roots of \(f_{3}(\lambda)=0\). Then we have \(\lambda_{1} + \lambda_{2} + \lambda_{3} + \lambda _{4}+\lambda_{5} =n+6 \) since \(\sum_{i=1}^{i=n}\mu_{i}=2m(G)\). For \(b \geq1\), \(Q_{a,b}\) contains \(Q_{1,1}\) as a subgraph. Then by Lemma 2.7 we have \(\lambda_{3} \geq\mu_{3}(Q_{1,1})=2\) and \(\lambda_{4} \geq\mu_{4}(Q_{1,1})=1.26\). Therefore, \(S_{2}(Q_{a,b}) = \lambda_{1} + \lambda_{2} = n+6- \lambda _{3} - \lambda_{4} - \lambda_{5} < n+3\). In what follows, we assume \(b=0\). Since \(f_{3}(1)=0\), we can rewrite \(\phi(Q_{a, 0},\lambda )=\lambda(\lambda-1)^{n-5}f_{4}(\lambda)\), where \(f_{3}(\lambda )=(\lambda-1)f_{4}(\lambda)\). Let \(\lambda_{1}' \geq\lambda_{2}' \geq\lambda_{3}' \geq\lambda _{4}'> 0\) be the four roots of \(f_{4}(\lambda)=0 \). Then we have \(\lambda_{1}' + \lambda_{2}' + \lambda_{3}' + \lambda _{4}' = n+5\) since \(\sum_{i=1}^{i=n}\mu_{i}=2m(G)\). For \(a \geq1\), \(Q_{a, 0}\) contains \(Q_{1,0}\) as a subgraph. Then by Lemma 2.7 we have \(\lambda_{3}' \geq\mu_{3}(Q_{1,0})=2\). Thus, \(S_{2}(Q_{a,b}) = \lambda_{1}' + \lambda_{2}'= n+5-\lambda_{3}' - \lambda_{4}' < n+3\). If \(a=0\), then \(S_{2}(Q_{a,b}) = S_{2}(C_{4}) < m(C_{4})+3\) by a straight calculation. This completes the proof. □

Now, we come to the main results of this paper.

Theorem 3.4

For any unicyclic graph G, \(S_{2}(G) \leq m(G)+3 \) with equality if and only if \(G \cong T(n-3,0,0)\).

Proof

For any unicyclic graph G, we assume that \(C_{k}=v_{1}v_{2} \cdots v_{k}v_{1}\) is the unique cycle in G (for some k) and G has the form \(U(R_{1},\ldots, R_{k})\). For \(k \geq5\), \(G-v_{1}v_{2}\) is a tree with \(d (G-v_{1}v_{2}) \geq 5\). Then by Lemma 3.1 we have \(S_{2}(G) < m(G)+3\). We now consider the following two cases.

Case 1. \(k=4 \).

Let \(C_{4}=v_{1}v_{2}v_{3}v_{4}v_{1}\) be the unique cycle in G. If there exist \(e(v_{i}) \geq2\), say \(e(v_{1})\geq2\), then \(G-v_{1}v_{2}\) is a tree with \(d(G-v_{1}v_{2}) \geq5\); if there are two adjacent vertices in \(C_{4}=v_{1}v_{2}v_{3}v_{4}v_{1}\), say \(v_{1}\) and \(v_{2}\), such that \(e(v_{1}) \geq1\) and \(e(v_{2}) \geq1\), then \(G-v_{1}v_{2}\) is a tree with \(d (G-v_{1}v_{2}) \geq5\). Then by Lemma 3.1 we have \(S_{2}(G) < m(G)+3\). We now assume \(G \cong Q_{a, b}\) (see Figure 4). Then the result follows from Lemma 3.3.

Case 2. \(k=3 \).

If \(\max \{e(v_{1}), e(v_{2}), e(v_{3}) \} \geq3 \), say \(e(v_{1})\geq 3 \), then \(G-v_{1}v_{2}\) is a tree with \(d(G-v_{1}v_{2}) \geq5\); if there are two vertices in \(C_{3}=v_{1}v_{2}v_{3}v_{1}\), say \(v_{1}\) and \(v_{2}\), such that \(e(v_{1})=2\) and \(e(v_{2}) \geq1\), then \(G-v_{1}v_{2}\) is a tree with \(d (G-v_{1}v_{2}) \geq5\). Therefore, Lemma 3.1 implies that \(S_{2}(G) < m(G)+3\). We now assume \(G \cong F_{1,t,n-2t-3}\) (\(t \geq1\)) or \(G \cong T_{a,b,c}\). Then the result follows from Lemma 2.13 or Lemma 3.2.

This completes the proof. □