The graphs with all but two eigenvalues equal to $-2$ or $0$

We determine all graphs for which the adjacency matrix has at most two eigenvalues (multiplicities included) not equal to $-2$, or $0$, and determine which of these graphs are determined by their adjacency spectrum.


Introduction
In an earlier paper [3] we determined the class G of graphs with at most two adjacency eigenvalues (multiplicities included) different from ±1. The classification was motivated by the question whether the friendship graph is determined by its spectrum. Here we deal with the class H of graphs for which the adjacency matrix A has all but at most two eigenvalues equal to −2 or 0. Equivalently, A + I has at most two eigenvalues different from ±1. The class H is in some sense complementary to G. Indeed, many graphs in G (including the friendship graphs) are the complements of graphs in H. In particular it easily follows that a regular graph is in G if and only if its complement is in H. But for non-regular graphs there is no such relation.
Note that a graph from H remains in H if we add or delete isolated vertices. Let H ′ be the set of graphs in H with no isolated vertices. Then it clearly suffices to determine all graphs in H ′ .
It turns out that H ′ contains several infinite families and some sporadic graphs, and that relatively few graphs in H ′ have a cospectral mate. Thus we find many graphs with four distinct eigenvalues which are determined by their adjacency spectrum; see [5] for some discussion on this phenomenon.
The major part of our proof deals with graphs in H ′ with two positive eigenvalues. These graphs have least eigenvalues −2 and have been classified, see for example [4]. However, using this classification is not straightforward, and we decided to start from scratch using mainly linear algebra. The most important tool is eigenvalue interlacing, which states that 2 Graphs in H ′ with just one positive eigenvalue It is known (see [7]) that a graph with just one positive adjacency eigenvalue is a complete multipartite graph, possibly extended with a number of isolated vertices. Thus we have to find the complete multipartite graphs in H ′ . Theorem 2.1. If a graph G ∈ H ′ has one positive eigenvalue, then G is one of the following.
Suppose there are k 1 ≥ 1 classes of size 1 and assume k ≥ k 1 + 3. Then at least one class has size 2, and at most one class has size greater than 2 (because K 2,3,3 is a forbidden induced subgraph). If one class has size m ≥ 3, then the adjacency matrix A of G admits an equitable partition with quotient matrix By Lemma 1.1, the eigenvalues of Q are also eigenvalues of A, but Q has three eigenvalues different from −2 and 0, so G ∈ H ′ 1 . If k 1 ≥ 3, then A + I has at least 3 equal rows, and hence A has an eigenvalue −1 of multiplicity at least 2, and therefore G ∈ H ′ 1 . If k 1 = 2 and G contains K 2,3 (which has smallest eigenvalue − √ 6 < −2), then G has an eigenvalue equal to −1, and an eigenvalue less than −2, so G ∈ H ′ 1 . So only K 1,2,...,2 , K 1,ℓ,m , K 1,1,m , and K 1,1,2,...,2 are not covered yet by the above cases, and one easily checks that only K 1,2,...,2 = G 2 (k, 1) and K 1,1,3 = G 1 survive. The eigenvalues readily follow by use of Lemma 1.1, or from [6]. ✷ The graph K 2,...,2 with k ≥ 1 classes is also known as the cocktail party graph, usually denoted by CP (k). We will write C(k) for the adjacency matrix of CP (k). The spectrum of CP (k) equals {−2 k−1 , 0 k , 2k − 2}. Note that CP (k) with k ≥ 2 and K 1,4 are the only graphs in H ′ with just one eigenvalue different from −2 or 0. Clearly there is no graph in H ′ with no positive eigenvalue, so we have the following result: (The disjoint union of two graphs G and G ′ is denoted by G + G ′ , and mG denotes m disjoint copies of G.) Theorem 2.2. Suppose G is a graph with n vertices and at most one eigenvalue different from −2 and 0, then G = nK 1 , Corollary 2.3. If G is a disconnected graph in H ′ , then G is one of the following: Proof. Suppose G ∈ H ′ has c components, then each component has at least one edge, and therefore at least one positive eigenvalue. Thus G has c positive eigenvalues. So, if G is disconnected then c = 2, and each component is K 1,4 or CP (k) with k ≥ 2. ✷

Graphs in H ′ with two positive eigenvalues
In this section we determine the set H ′ 2 of connected graphs in H ′ with two positive eigenvalues. We start with some tools. We call a pair of vectors v and w ∈ {0, 1} n almost equal whenever v and w have different weights, and differ in at most two positions. Proof. Let a ≥ b be the weights of two (almost) equal columns of A + I. Then a − b ≤ 2 and E = A(A + 2I) = (A + I) 2 − I has the following principal submatrix which is not positive semi-definite. ✷ Proof. Interlacing. Each of the adjacency matrices has smallest eigenvalue less than −2, or more than two positive eigenvalues. ✷ Let α = α(G) be the maximum size of a coclique (that is, an independent set of vertices) in G. We will distinguish a number of cases depending on α.

Graphs in H
then G is one of the following graphs (represented by their adjacency matrices): Proof. Let G be the complement of G. Since α(G) = 2, G has no triangles. It is well-known that the complement of an odd cycle C n with n ≥ 5 has at least three positive eigenvalues. Therefore, by interlacing, G has no induced odd cycle, so G is bipartite and the adjacency matrix A of G has the following structure: First we claim that |m−m ′ | ≤ 1. Indeed, suppose m ≤ m ′ −2, then J m ′ −I has eigenvalue −1 of multiplicity m ′ − 1, and therefore, by interlacing, A has an eigenvalue −1 of multiplicity Consider four columns s, t, u, v of A + I, with s and t in the first part and u and v in the second part. Let m + a, m + b (a ≤ b), m ′ + c, and m ′ + d (c ≤ d) be the weights of s, t, u and v respectively, and define λ = s ⊤ t − m and µ = u ⊤ v − m ′ . Then these four columns give the following submatrix of E = A(A + 2I): After Gaussian elimination (subtract the first row from second row and the last row from the third row, and apply a similar action to the columns) we obtain By Lemma 3.1, rank(E ′′ ) ≤ 2, which implies that the upper 3 × 3 submatrix of E ′′ has determinant 0, which leads to By Lemma 3.2, no two rows of A + I are equal or almost equal which implies that a ]. The first two options do not occur, because A + I has almost equal columns (but note that the second case gives K 1,2,...,2 ). For the other cases A has equitable partitions with quotient matrices respectively. These quotient matrices, and therefore the adjacency matrices, have three eigenvalues different from −2 and 0, unless m = 2 in the first case (which gives K 1,2,2 ), and m = 7 in the second case. ✷

Graphs in H
Theorem 3.5. If G ∈ H ′ 2 and α(G) ≥ 3, then G is one of the following graphs (represented by their adjacency matrices): • G 9 (k) : (k ≥ 0, if k = 0, the last block row and column vanish), • G 10 : Proof. Let C be a coclique of G of size α ≥ 3. We assume that C has the largest number of outgoing edges among all cocliques of size α. The coclique C, and the remaining vertices of G give the following partition of the adjacency matrix A of G.
Suppose rank(N ) ≥ 3. Then N has a 3 × 3 submatrix of rank 3, and A has a nonsingular principal submatrix A ′ of order 6 containing O of order 3. Interlacing gives λ 3 (A ′ ) ≥ λ 3 (O) = 0. But A ′ is nonsingular, so λ 3 (A ′ ) > 0, and interlacing gives λ 3 (G) > 0, contradiction. So rank(N ) ≤ 2. Suppose N = J, then B = J − I, since otherwise G contains the forbidden subgraph K 2,3 . Thus we have G = K α,1,...,1 which has been treated in Section 2. We easily have that N has no all-zero column (because C is maximal), and no all-zero row (because G is connected). We conclude that rank(N ) = 2 and N has one of the structures (i), (ii), (iii), (iv). We will continue the proof by considering these four cases step by step.
One easily checks that none of these give a graph in H ′ 2 . So p = 2. We assume a ≥ b (if p = q = 2 we can do so, and if q > p, then the same forbidden subgraphs as above imply b ≤ 2, but if b = 2 and a = 1 then the last two columns of A + I are equal or almost equal, which contradicts Corollary 3.2). Forbidden subgraph (d) shows that each row of B 1 has weight a − 1, or a − 2. If B 1 has an off-diagonal 0, then the two corresponding rows have weight a − 2, and G has another coclique of size α. The two corresponding rows of M have weight 0, because otherwise the other coclique would have more outgoing edges. So if all rows of B 1 have weight a − 2, then M = O, and G is disconnected. Therefore at least one row (the first one, say) of B 1 has weight a − 1. Now rows 1, 3 and α + 1 of A give the following submatrix of E = A(A + 2I): where x is the weight of the first row of M . By Proposition 3.1, rank(E) = 2, so det(E ′ ) = 0, which leads to b/a = bx − x 2 − b. Therefore b/a is an integer, and since a ≥ b, we have a = b and 2x = a ± (a − 2) 2 − 8. This equation only has an integer solution if a = b = 5 and x = 2, or 3. Forbidden subgraphs (b) and (f ) show that q < 3, so p = q = 2. Now also B 2 has a row (the first one say) with weight b − 1 = 4, and the corresponding row of A together with the three rows considered above, give a 4 × 4 submatrix of E of rank 3, contradiction with Proposition 3.1.

Cases (ii) and (iii)
We consider case (iii), but include (ii) by allowing a = 0, or b = 0 (not both). The forbidden subgraph K 1,5 gives p + q = α ≤ 4. First consider α = 4. Then forbidden subgraphs (b) and (i) give c = 1, and (b), (k), (ℓ) and (j) imply that p = q = 2. We assume a ≥ b. Moreover, the forbidden graph (m) shows that the last vertex of A is adjacent to all other vertices. So A has the following structure Like in Section 3.2.1, p = 2 implies that a row of B 1 has weight a − 1 or a − 2. If some row of B 1 (the first one, say) has weight a − 1, then row 1, 2 and 5 of A give the following submatrix of E = A(A + 2I): where x is the weight of the first row of M . By Proposition 3.1 det(E ′ ) = 0, which implies that x = b and x = 1+1/(a+1)+1/(b−x), which has no solution (because a ≥ b). Therefore each row of B 1 has weight a − 2, and B 1 = C(a/2). But then M = O, since otherwise G would have another coclique of size 4 with more outgoing edges. Also B 2 = C(b/2) (CP (0) is the graph with the empty vertex set), because if a row of B 1 would have weight b − 1, then the corresponding row of A + I and row 3 of A + I are almost equal, which contradicts Corollary 3.2. Now reordering rows and columns of A shows that G = G 8 (k, ℓ)). The eigenvalues readily follow by use of Lemma 1.1.
Next we consider α = 3. Then we take p = 1, q = 2. The forbidden graphs (b) and (f ) show that c = 1 or 2. First suppose c = 1. Then We have B 1 = J − I, because C is maximal. Let x be the weight of an arbitrary row of M . If x = 0, then the corresponding row of A + I is equal or almost equal to the first row of A + I. So x ≥ 1. Because no coclique of size 3 has more outgoing edges than C, it follows that x = 1 and v = 0. Forbidden subgraph (e) gives w = 1. But now the last row of A + I is almost equal to the second row. So there is no solution when α = 3 and c = 1. (Note that the conclusion also holds if a = 0 or b = 0.) Suppose c = 2. We assume p = 1, q = 2. Then A has the following structure.
Like before, we have that B 1 = J − I. Consider the submatrix of E made from the second, the fourth and the last two rows of A, and then replace the last two rows and columns by their sum. Then we get a + 2 a + 6 2b + 6 a + 6 a + 4b + 18   .
However, the second options does not occur, because it would give a column in A + I which is almost equal to the last column of A + I. Similarly, if a column of M , different from the first one, has weight b − 1, then the corresponding column in A + I is almost equal to the last one. So these columns of M all have weight b − 2. However, the first row and column of M has weight b − 1, since if some off-diagonal entry (the second, say) of the first row of M is zero, then rows and columns 2, 3, 4, 6, 7 give the forbidden subgraph (e). Now there is just one family of solutions for A, which, after reordering rows and columns shows that G = G 9 (k). The spectrum follows in a straightforward way by use of Lemma 1.1. This finishes cases (ii) and (iii).

Case (iv)
We have the following adjacency matrix.
We assume p ≤ q. There is a somewhat special behaviour when p = r = b = 1, so we treat this case first. Forbidden subgraph (a), (b) and (d) show that q ≤ 3 and that each row of B 1 has weight at least a − 2. If some row of B 1 has weight a − 1, then A + I has two almost equal rows, hence B 1 is the adjacency matrix of CP (a/2). Two nonadjacent vertices in CP (a/2) together with q vertices of C make another coclique in G of size α which, by assumption, has not more outgoing edges than C. Therefore the two corresponding entries of M cannot both be equal to 1 and therefore the weight x of M satisfies x ≤ a/2. The first, the second and the last row of A give the following submatrix of E = A(A + 2I): Proposition 3.1 gives det(E ′ ) = 0, which implies 2x = a ± (a + 2(q − 3)) 2 − 4(q − 3) 2 . If q = 1 we get a = 9, which is not possible. If q = 2 we get a = 4, x = 2, which gives G 10 . If q = 3 there is no solution, because G contains a forbidden subgraph (k) or (ℓ).
Next we treat the case p = q = r = 1 and b ≥ 2. Then, like before, forbidden subgraphs (b) and (d) imply that the a row of B 1 has weight a−1 or a−2. Suppose all rows have weight a − 2, so B 1 represents CP (a/2). Now the first, the second and k-th row of A (4 ≤ k ≤ a + 3) give the following submatrix of E = A(A + 2I): where x is the weight of the corresponding row in M . This matrix is singular, which implies that x = 0, or x = b. Since b ≥ 2, no row or column of B 2 has weight b, since otherwise A + I would have two equal or almost equal columns. So B 2 is the adjacency matrix of CP (b/2), and the columns of M have weight 0 or a. So M = O or M = J, but M = J is impossible, because then one vertex of C and two nonadjacent vertices of CP (a/2) make up a coclique of size 3 with more outgoing edges than than C has. Thus we find an equitable partition of A with quotient matrix For all positive integers a and b, Q and hence A has at least three eigenvalues different from −2 and 0.
We conclude that at least one row of B 1 has weight a−1 and find the following submatrix E ′ of E = A(A + 2I): where x is the weight of the corresponding row of M . Now det(E ′ ) = 0 gives x 2 −xb+b+b/a = 0, We assume a ≥ b. Then b = a and 2x = b ± (b − 2) 2 − 8. This only has an integer solution if b = 5. Then x = 2 or x = 3. It is straightforward to check that there is no matrix A that satisfies all requirements. [A quick way to see this is by extending E ′ above to a 4 × 4 matrix E ′′ by considering also a row of B 2 with weight 4. If x ′ is the weight of the corresponding row of M ⊤ , then rank(E ′′ ) = 2 implies that x = 2, x ′ = 3 (or vice versa). This is clearly impossible if all rows of B 1 and B 2 have weight 4. However, if a number of rows of B 1 and B 2 have weight 3, then this number is even and the corresponding rows of M and M ⊤ have weight 0 or 5 (see above). This gives that the sum of row weights of M is equal to 2 or 1 (mod 5), whilst the column weights add up to 3 or 4 (mod 5),which is of course impossible.] This finishes the case p = q = r = 1.
The next case is p = r = 1, q ≥ 2. Forbidden subgraphs a and b give q = 2 and b ≤ 2, or q = 3, b = 1. The case b = 1 is solved above, so we only need to deal with b = q = 2. Then forbidden subgraph (b) gives that B 2 = J − I. We consider the submatrix E ′ of E = A(A + 2I) formed by the first, the second and the last row of A. Then where x is the weight of the second column of M . We have 0 = det(E ′ ) = a(2x − 1) − 2x 2 , which implies x = 1, a = 2. Now it is straightforward to check that there is no solution.
Only the first and the last 5-tuple correspond to a solution: G 11 and G 12 , respectively. ✷

Conclusions
The graphs in H ′ are given in Theorems 2.1, 3.4, 3.5 and Corollary 2.3. The graphs G 8 (2, 2) and G 11 are the only two nonisomorphic cospectral graphs in H ′ . All other pairs of cospectral graphs in H consist of pairs of graphs in H ′ with the same nonzero part of the spectrum (see Theorem 4.1 below), where one or both graphs are extended with isolated vertices, such that the numbers of vertices in both graphs are equal. The following theorem follows straightforwardly from the list of graphs in H ′ .
For every graph in H we can decide whether it is determined by the spectrum of the adjacency matrix by use of Theorem 4.1. For example CP (k) + K 1 , which is the complement of the friendship graph, is determined by its spectrum because every graph with the same nonzero part of the spectrum equals CP (k) + mK 1 for some m ≥ 0. This result was already proved in [1]. Also the spectral characterisation of complete multipartite graphs is known, see [6].