Cospectral constructions for several graph matrices using cousin vertices

Graphs can be associated with a matrix according to some rule and we can nd the spectrum of a graph with respect to that matrix. Two graphs are cospectral if they have the same spectrum. Constructions of cospectral graphs help us establish patterns about structural information not preserved by the spectrum. We generalize a construction for cospectral graphs previously given for the distance Laplacian matrix to a larger family of graphs. In addition, we show that with appropriate assumptions this generalized construction extends to the adjacencymatrix, combinatorial Laplacianmatrix, signless Laplacianmatrix, normalized Laplacian matrix, and distance matrix. We conclude by enumerating the prevelance of this construction in small graphs for the adjacency matrix, combinatorial Laplacian matrix, and distance Laplacian matrix.


Introduction
In the most general terms, graph theory is the study of objects (vertices) and their relations (edges). Models of network systems use graphs, such as communication networks, where two communication centers are connected if they can send signals to each other. As these networks grow large, it becomes more di cult and more cumbersome to understand structural information. One way to gain an understanding of large graphs is by linear algebra tools; this requires a way to describe graphs with matrices.
Graphs can be associated with matrices by assigning matrix entries corresponding to the graph structure. For example, assign in the i, j entry if there is an edge between vertex i and vertex j and otherwise (this gives the adjacency matrix). Spectral graph theory is the study of relating the spectrum (multi-set of eigenvalues) of a matrix to structural properties of a graph.
Let G = (V , E) be a graph and M be a matrix associated with the graph. Then the spectrum (multiset of eigenvalues) of M, spec M (G), is referred to as the spectrum of G with respect to M. If M is clear, we will say the spectrum of G, denoted spec(G). If two graphs G , G share the same spectrum with respect to M, i.e. spec M (G ) = spec M (G ), then we say that G , G are cospectral graphs.¹ When G is not isomorphic to G , this is an interesting relationship between the two graphs because it gives us information into what structural properties of a graph are not preserved by M. There are many possible choices for M, and each gives us a di erent insight into the graph.
Given M, examples of cospectral graphs are (usually) easy to nd for a small number of vertices by exhaustive search. To nd families of cospectral graphs on a large number of vertices, we need constructions.
These constructions help us understand how information about the structural proprieties of a graph are not determined by the spectrum and demonstrate the weaknesses of a matrix.
Cospectral constructions have been studied for the adjacency matrix [7], combinatorial Laplacian matrix [6,8], signless Laplacian matrix [8], normalized Laplacian matrix [4], distance matrix [9], and to a lesser extent distance Laplacian matrix [2,3]. The adjacency matrix A has a in the i, j entry if there is an edge between vertices i, j, and otherwise. Two vertices are adjacent, denoted u ∼ v, if uv ∈ E. The degree of a vertex, denoted deg(v), is the number of vertices that are adjacent to v. The combinatorial Laplacian matrix is de ned as L = D − A, where D is the diagonal matrix with the degrees of the vertices down the diagonal. The signless Laplacian matrix is de ned as |L| = D + A. The normalized Laplacian matrix is de ned as L = D − / LD − / . These matrices o -diagonal zero-nonzero pattern is that of the adjacency matrix; therefore, we will refer to these matrices as adjacency matrices.
A path of length k is a sequence of distinct vertices (v , (u, v), between two vertices in a graph G is the length of the shortest path starting at u and ending at v. The distance matrix D has entries D i,j = dist(i, j). The transmission of a vertex is de ned as tr(v) = u∈V dist(u, v). The distance Laplacian matrix D L = T − D where T is the diagonal matrix with the transmission of the vertices (sum of the distances to a particular vertex) down the diagonal. When dealing with distance matrices, the graph is assumed to be connected (there is a path between every pair of vertices).
The most well known cospectral construction for graphs is Godsil-McKay switching for the adjacency matrix [7]. The construction is a special case of a graph operation called Seidel switching. Seidel switching on a graph G with switching set S produces a new graph G . The graph G is on the vertex set of G and edges of G with both of the endpoints in either S or G\S. The graph G also has edges between vertices in S and G\S if and only if that edge was not in G. An example of this switching on a graph with switching set S = {v} is shown in Figure 1. Seidel switching does not necessarily produce a pair of cospectral graphs for the adjacency matrix.
v v Godsil-McKay switching puts conditions on the graph G and the switching set to create a pair of cospectral graphs. Their proof consists of showing that a matrix C = diag( k J − I, I) is a similarity matrix for the adjacency matrix of the two cospectral graphs. Haemers and Spence extended the construction to L and |L| by introducing the GM*-property and its relaxation for graphs [8]. The GM*-property is a set of su cient graph conditions such that C is a similarity matrix for matrices of the form M = αA + βI + γD. The relaxation of the GM*-property weakens the required graph conditions if the matrix has constant row sums. This extension is one of the most well known cospectral construction for the Laplacian and signless Laplacian matrices.
This construction and others for well-studied matrices can be thought of as a switch of a set of edges [1,[7][8][9]13]. In this paper, we present a construction that swaps a set of edges. The di erence between these two concepts is in a switch exactly one endpoint of an edge change while in a swap, both endpoints of an edge change.
A well known construction of cospectral pairs of graphs with no cycles, called trees, uses swapping [10,12]. The construction identi es special trees T , T with special vertices u , u that create a pair of cospectral trees when alternately merging u , u with a vertex v of another tree. In other words, the subtree T is swapped for subtree T to create a cospectral pair of graphs for the adjacency matrix, combinatorial Laplacian matrix, signless Laplacian matrix, and distance matrix. The construction presented in this paper di ers by almost always introducing a cycle to the graph (hence the cospectral pair are not a tree), and, for several matrices, there are numerous options for subgraphs to be swapped.
Our result broadens a construction for the distance Laplacian matrix and extends it to the distance matrix, matrices of the form M = αA + βI + γD, and the normalized Laplacian matrix. We do this by demonstrating graph conditions such that diag( k J −Î, I) is a similarity matrix, whereÎ is the matrix with ones along the anti-diagonal and zeros elsewhere. Our result is the only known cospectral construction for both distance and adjacency matrices when the diameter of the graph (the diameter, denoted diam(G), is the maximum distance between two vertices in G) is greater than two and not a tree.
This construction exploits well known spectral properties of twin vertices in both distance and adjacency matrices. (Isolated) Twin vertices are two vertices in a graph that have the same neighborhood (and thus are not connected). In a distance or adjacency matrix representation of a graph, the columns (and rows) corresponding to twin vertices, v , v , have the same entries in each row (and column) corresponding to the other vertices in the graph. In other words, Mv ,u = Mv ,u for all u ∈ V\{v , v }. This allows [ , − , , · · · , ] T to be an eigenvector of our matrix. Since these matrices are real symmetric matrices, our remaining eigenvectors can be chosen such that the rst two entries are the same. This leads to a very natural cospectral construction, which is formally given for the combinatorial Laplacian matrix in [5] and the distance Laplacian matrix in [3]. For the combinatorial Laplacian matrix, the construction says that if we have two sets of isolated twin vertices of the same size and they have the same degree, then the pair of graphs produced by adding k edges into one set or the other are cospectral. In other words, these k edges can be swapped from one twin set to another. An example of this construction is shown in Figure 2.
We will show that the twin condition can be relaxed for the combinatorial Laplacian matrix when constructing cospectral graphs and can be broadened to include all adjacency and distance matrices. This relaxation is an extension of a cospectral construction for the distance Laplacian matrix given in [3] and an example is shown in Figure 3.
The graphs shown in (b) and (c) are the two graphs formed by swapping edges to create a pair of cospectral graphs using the construction given in [3].
We will describe this construction in Section 2 and give generalized de nitions of sets of twin vertices called cousins. These de nitions allow us to show that a matrix S = diag( k J −Î, I) is a similarity matrix between graphs where we perform a swap on the edges between the cousin vertices.
This construction method demonstrates a loss of information about the graph structure from many di erent matrix representations. To show this construction, we will rst introduce cousin vertices and prove some simple results about gluing edges within cousins. Then we will prove some linear algebra results about real symmetric matrices to show that our graph construction preserves the spectrum of adjacency and distance matrices. In Section 3, we will enumerate the prevalence of this construction for on a small number of vertices for the adjacency matrix, combinatorial Laplacian matrix, and distance Laplacian matrix. Finally, we will conclude in Section 4 with some remaining questions about the frequency this construction occurs and complementary cospectral constructions.

Extension of Cousin Cospectral Construction
The cospectral construction given in [3] which we wish to extend starts with a set of vertices with special proprieties called cousins.

De nition 2.1. [3] In a graph G, the set of vertices
We can think of them as two sets of twin vertices with the same transmission if we ignore adjacencies between our special four vertices. The construction of cospectral graphs for the distance Laplacian matrix swaps the complete graph with the empty graph between {v , v } and {v , v } with some conditions to create a pair of cospectral graphs. The graph on n vertices with all possible edges is called the complete graph, denoted Kn. The graph on n vertices with no edges is called the empty graph, denoted Kn. An example of this construction is shown in Figure 3.
Our construction extends swapping of edges from a pair of two vertex sets to a pair of m vertex sets. Therefore, we will rst extend the de nition of cousins.

De nition 2.2.
In a graph G, the pair of sets of vertices U and W are called cousins if These de nitions about pairs of sets of vertices will be used for our construction for the distance and distance Laplacian matrices. The next de nitions about pairs of sets of vertices will be used for our construction for the adjacency, combinatorial Laplacian, and signless Laplacian matrices. Let N(v) denote the set of vertices that share an edge with vertex v called the neighborhood.

De nition 2.3.
In a graph G, the pair of sets of vertices U and W are called relaxed cousins if We will note that a pair of relaxed cousins encompasses a pair of (co-transmission) cousins. Additionally, if there are no edges between sets U, W, then these must be a pair of sets of twin vertices. For our cospectral constructions, we will start with a base graph and glue in two graphs two di erent ways creating cospectral graphs. This operation can formally be de ned using maps and the following example demonstrates gluing by using maps.
Example 2.4. Let G be an empty graph on four vertices and let H be the complete graph on three vertices.
is the graph K union with an isolated vertex. We would say that G is G with H glued into G with respect to ϕ. This example is pictured in Figure 4.
An interesting property about cousins is that gluing into U or W does not change the length of a shortest path between two vertices u, v where v is not in U or W. Lemma 2.5. Let G be a graph with cousins V , V on m vertices. Let H , H be any two graphs on m vertices and ϕ i,j be a bijective mapping from H i to V j for i, j ∈ { , }. Let G = G + ϕ , (E(H )) + ϕ , (E(H )) and G = G + ϕ , (E(H )) + ϕ , (E(H )). Then . If a shortest path in G does not contain an edge with both its endpoints in V nor V and a shortest path in G does not contain an edge with both its endpoints in V nor V , then the distances are the same, i.e. dist G (u, v) = dist G (u, v) since G and G only di er by edges that have both of their endpoints in V or V . Let P be a shortest path in G between u, v that contains, without loss of generality, edge (w , w ) where w , w ∈ V . We know for any subpath P ⊆ P that starts at vertex x and ends at vertex y, then P is a shortest path between x and y.
This implies that a shortest path between u and w uses edge (w , w ). Moreover, dist(u, w ) + = dist(u, w ) but every u ∉ V ∪ V must be equidistant from vertices in V (and V ) since they are cousins. Therefore, there is no shortest path P that contains an edge with both of its endpoints in V . There is an analogous argument for V and G .
Thus the distance between u, v is preserved from G to G .
An additional interesting property of gluing is when we glue into a bipartite graph (we say that a graph is bipartite if V = A ∪ B and E ⊆ {(a, b)|a ∈ A, b ∈ B}, in other words, all the edges go between the parts A and B) G = (A ∪ B, E) that has an automorphism π where π(A) = B and π = id, then gluing any graph H into A with map ϕ is isomorphic to gluing H into B with map π(ϕ). V(H B ) to V(B). E(H B ))).

Lemma 2.6. Let G = (A ∪ B, E) be a bipartite graph with independent sets A, B on m vertices such that there exists a graph automorphism π where π(A) = B, π(B) = A, and π = id. Let H A and H B be any two graphs on m vertices, ϕ A be a bijective mapping from V(H A ) to V(A), and ϕ B be a bijective mapping from
Proof. Let π be a graph automorphism of G = A ∪ B such that π(A) = B, π(B) = A, and π = id. Since π is a graph automorphism of G, then E(G) = π(E(G)). Consider Therefore π is a graph isomorphism of G , G .
In our construction method we will be using this idea

. Linear Algebra Results
We now discuss some linear algebra tools developed to operate with anti-diagonal re ections. When a n × n matrix M is re ected along its anti-diagonal, we denote this with T M and this matrix has (i, j)-entry m n−j+ ,n−i+ . Let I be the n × n matrix with ones along the anti-diagonal and zeros elsewhere. In other words, I reverses the order of a column or row vector when multiplied from the right or left respectively. Therefore IM is the matrix M but where each column is in reverse order (horizontal re ection). And M I is the matrix M but where each row is in reverse order (vertical re ection).
Therefore, IM I is the matrix M but with all the columns and rows in reverse order.
To have M be re ected along its anti-diagonal (thus have the anti-diagonal be stationary), we must take the transpose of IM I. Therefore T M = ( IM I) T = IM T I since I is its own transpose.
Note that ( I) = I therefore I is its own inverse. So M T is similar to T M and we know that M is similar to M T . Thus M is similar to T M.
The next result gives an explicit matrix that only re ects a submatrix along its anti-diagonal given some conditions about the initial matrix. Proof. Let M be a matrix with the proprieties stated in the hypothesis. Consider the matrix where J is the all ones matrix. Observe that S is its own inverse and transpose. We will show that S is a similarity matrix for M and M . In other words, we will show First, we will show that k J − I N k J − I = T N and then k J − I Q = Q. We know that N is a symmetric k × k matrix and let α be the constant row and column sum of N. Additionally, since I reverses the columns or rows of a matrix, it follows that J I = J and IJ = J. Using these facts and Lemma 2.7, consider the following. We now are ready to provide graph structural conditions that create cospectral graphs that have S (as de ned in (1)) as a similarity matrix.

. Construction method
The method of creating cospectral graphs for the distance Laplacian matrix given in [3] not only generalizes to larger families of graphs, it also extends to other matrices. This is because the proof used the fact that the distance Laplacian matrix has constant row sums equal to zero. Thus it is very natural to extend it to the combinatorial Laplacian matrix which also has row and column sums equal to zero. To extend this construction to other matrices (adjacency matrix, signless Laplacian matrix, normalized Laplacian matrix, and distance matrix), there are more necessary graph conditions. The constructions outline necessary graph conditions such that Lemma 2.8 can be applied to the matrix. Therefore, our argument will be that the columns of Q are of the appropriate form and that gluing our graphs H , H into G in two ways results in the anti-diagonal ip of N.

Let H and H be any two graphs on m vertices and ϕ i be a bijective mapping from H i to
• If V and V are co-transmission cousins, then G and G are cospectral for the distance Laplacian matrix. Proof. First consider the cases for the distance matrices where V , V are cousins (since co-transmission cousins are a special case of cousins). By Lemma 2.5, we know that no shortest path uses an edge with both of its endpoints in V or V . Thus no distance between pairs of vertices where at least one is not in V nor V changes.
In the case of relaxed or co-degree cousins, we note that no adjacency changes between a pair of vertices where at least one is not in V nor V when we add edges with both of its endpoints in V or V .
So we can partition the respective matrix M of the two graphs G , G into where M , M are m × m submatrices that are indexed by the vertices in V followed by the vertices in V .
We claim that with the appropriate labeling M and M are permutation similar submatrices where the permutation is an anti-diagonal re ection. In other words, T M = M .
Let π be a graph automorphism of G[V ∪ V ] such that π(V ) = V , π(V ) = V , and π = id. We can relabel the vertices of V in G such that π(v ,i ) = v ,m−i+ and π(v ,i ) = v ,m−i+ for v ,i ∈ V and v ,i ∈ V since π is an involution. By Lemma 2. This allows us to create many di erent cospectral graphs on several matrices. Next we present some examples of this construction.
Example 2.10. Consider the graphs in Figure 5. The graph in (a) is a graph G with co-transmission cousins For our graph G we can see that this is a graph automorphism for G[V ∪ V ]. Therefore, by Theorem 2.9 we can glue any two graphs on four vertices into V , V and then into V , V with respect to π to create a pair of cospectral graphs for the distance Laplacian matrix.
In (b) and (c) we have glued the H and H = K into the cousin sets in two di erent ways to create cospectral graphs. Example 2.11. Consider the graphs in Figure 6. The graph in (a) is a graph G with co-degree cousins Therefore, by Theorem 2.9 we can glue any two graphs on six vertices into V , V and then into V , V with respect to π to create a pair of cospectral graphs for the combinatorial Laplacian matrix.
Since we glued in two non-isomorphic -regular graphs such that G [V ∪ V ] in (b) is a regular graph, we also create a pair of cospectral graphs for the signless Laplacian and adjacency matrix. Additionally, since G [V ∪ V ] has diameter and is regular, it is also transmission regular. Therefore, this pair of graphs in (b) and (c) are also cospectral for the distance matrix.
We can have pairs of cospectral graphs using Theorem 2.9 for the adjacency matrix without being cospectral for the signless Laplacian matrix. Figure 7 gives such a pair. Since the conditions for the signless Laplacian matrix construction are a special case of the conditions for the adjacency matrix and a special case of the combinatorial Laplacian matrix construction, it follows that anytime we have a pair of graphs that are cospectral for the signless Laplacian matrix using Theorem 2.9 these graphs are also cospectral for the adjacency matrix and the combinatorial Laplacian matrix.
The adjacency matrix, combinatorial Laplacian matrix, and signless Laplacian matrix can be related using the generalized characteristic polynomial. The generalized characteristic polynomial of a graph G, denoted ϕ G (λ, r) is the determinant of the matrix It can be bene cial to use this matrix because we can write our adjacency, combinatorial Laplacian, signless Laplacian, and normalized Laplacian matrix in terms of this matrix. For example if p M (λ) is the characteristic polynomial of M, then Therefore if ϕ G (λ, r) = ϕ H (λ, r), then graphs G, H are cospectral for the adjacency, Laplacian, signless Laplacian, and normalized Laplacian matrix. We have seen our construction classify pairs of graphs that are cospectral for three of these matrices and now we extend it to the generalized characteristic polynomial. Let H and H be any two graphs on m vertices and ϕ i be a bijective mapping from H i to V i for i ∈ { , }. Let G = G + ϕ (E(H )) + ϕ (E(H ))) and G = G + π(ϕ (E(H ))) + π(ϕ (E(H )))). v , Figure 6 gives an example of a graph G and graphs to glue in that meet the hypothesis of Corollary 2.12, therefore the graphs given in Figure 6 (b) and (c) have the same generalized characteristic polynomial and are cospectral for the normalized Laplacian matrix.

Enumeration
Examples demonstrate the existence of a construction while this section helps to show the prevalence of the cospectral construction for several graph matrices. We implement an algorithm for identifying (relaxed) cousin vertices (sets A, B) in a graph. We then nd a function from A to B such that the matrix described in (1) is a similarity matrix between a graph and its cospectral mate. If no such function is found, then the algorithm returns that the two graphs are not formed using the construction as described in Theorem 2.9.
This algorithm was run over cospectral pairs on , vertices for the adjacency matrix, combinatorial Laplacian matrix, and distance Laplacian matrix. The results are tabulated below.  From Table 1, we can see that for small number of vertices this construction is not prevalent in the adjacency matrix. This is reasonable as the construction requirements for the adjacency matrix are very restrictive.
For the combinatorial Laplacian matrix the number of graphs that have a cospectral pair using this construction is quite large. Combined with data about the prevalence of Godsil-McKay switching in [8], these two constructions account for more graphs than there are graphs with a cospectral mate! This would suggest that there are some graphs with a cospectral mate explained by more than one cospectral construction method.

Concluding Remarks
We have presented an extension of a construction method and applied it to many matrices. A natural question about this construction method is what fraction of cospectral graphs does this explain for each matrix as the number of vertices increases? In addition, there are smaller examples then those shown in this paper for some matrices, but it is unknown if there is a smaller example for the distance matrix. Is there an example of a pair of graphs that are cospectral for all six matrices discussed here that uses this new construction method?
There is also some evidence that the graph automorphism π as described in Theorem 2.9 does not need π(V ) = V and π(V ) = V for a similar construction shown in [3]. Finding other conditions or cases when π is some other graph automorphism where the spirit of Theorem 2.9 holds is an interesting open problem.
Cospectral constructions have now been shown for adjacency matrices using diag( k J − I, I) ( [7,8]) and diag( k J −Î, I) (Theorem 2.9) as similarity matrices. Since both I andÎ are symmetric permutation matrices, is there a cospectral construction for every symmetric permutation matrix P where diag( k J−P, I) is the similarity matrix? This problem has been studied for orthogonal matrices in [1,13] where the construction method is switching.
Data availability statement: The datasets generated during and/or analysed during the current study are available from the corresponding author on reasonable request.