Journal of Graph Algorithms and Applications Computing the Characteristic Polynomial of Threshold Graphs

We present an algorithm for constructing the characteristic polynomial of a threshold graph's adjacency matrix. The algorithm is based on a diagonalization procedure that is easy to describe. It can be implemented using O(n) space and with running time O(n 2).


Introduction
Given G = (V, E), an undirected graph with vertices V = (v 1 , . . ., v n ) and edge set E, its adjacency matrix A(G) = [a ij ] is the n×n 0-1 matrix for which a ij = 1 if and only if v i is adjacent to v j (that is, there is an edge between v i and v j ).Let x be an indeterminate.The characteristic polynomial of G is usually defined as ρ G (x) = det(xI n − A).Some authors define it as det(A − xI n ), however these polynomials differ by the factor (−1) n .Their roots are called the eigenvalues of G.
This paper is concerned with threshold graphs, introduced by Chvátal and Hammer [3] and Henderson and Zalcstein [5] in 1977.They are an important class of graphs because of their numerous applications in diverse areas which include computer science and psychology [10].Threshold graphs can be characterized in several ways.One way of obtaining a threshold graph is through an iterative process which starts with an isolated vertex, and where, at each step, either a new isolated vertex is added, or a dominating vertex is added.We may represent a threshold graph G on n vertices using a binary sequence (b 1 , . . ., b n ).
Here b i = 0 if vertex v i was added as an isolated vertex, and b i = 1 if v i was added as a dominating vertex.This representation has been called a creation sequence.In our representation b 1 is always zero.If n ≥ 2, G is connected if and only if b n = 1.In constructing an adjacency matrix, we order the vertices in the same way they are given in their creation sequence.Figure 1 shows the adjacency matrix of the threshold graph represented by (0, 1, 0, 1, 1).In [12] Sciriha and Farrugia discussed combinatorial and spectral properties of threshold graphs.Threshold graphs were studied in [1,13,14] under the name nested split graphs.In [8] the authors identified those threshold graphs having the smallest eigenvalue among all threshold graphs of order n, and in [9] showed that no threshold graph has an eigenvalue in the real interal (−1, 0).
Algorithms and formulas for the characteristic polynomial of trees have been studied in [7,6,11] and by M. Fürer, who in [4], presented an O(n log 2 n) algorithm for computing the characteristic polynomial of a tree on n vertices.
The good performance for tree algorithms is somewhat expected since the matrices associated are sparse.For general graphs there is no known algorithm for computing its characteristic polynomial that performs better than algorithms for general matrices, which can be obtained in O(n 3 ) [15].
Since adjacency matrices of threshold graphs can be dense, obtaining an efficient algorithm is a greater challenge.In this paper, taking advantage of the structure of the adjacency matrix, we present efficient algorithms for constructing the characteristic polynomial ρ G (x) where G is a threshold graph.We can assume that G is connected for otherwise ρ G (x) = x k ρ G (x), where G is a connected component.
Our characteristic polynomial algorithm is based on the diagonalization algorithm for threshold graphs presented in [8], and these ideas are reviewed in Section 2. In Section 3 we present an algorithm for constructing the characteristic polynomial of a threshold graph that runs in time O(n 2 log n) and space O(n).We illustrate our algorithm in Section 4. In Section 5 we discuss a method used in [12], based on equitable partitions, for computing the characteristic polynomial of threshold graphs.Finally, in Section 6, we sketch an interpolation approach that has time O(n 2 ) and space O(n).

Diagonalization
Recall that two matrices R and S are congruent if there exists a nonsingular matrix P such that R = P T SP .An important tool used in [8] was an algorithm for constructing a diagonal matrix D congruent to B x = A + xI, where A is the adjacency matrix of a threshold graph, and x is an arbitrary scalar.Our algorithm only adds scalar multiples of a row (column) to another row (column), i.e. performs elementary type III operations, and so det(P ) = 1.The algorithm is shown in Figure 2. The diagonal elements are stored in the array d, and the graph's initial representation is stored in b.
Algorithm Diagonalize works bottom up.For a graph of order n, it makes n − 1 steps.Each diagonal element, except the first and last, participates in two iterations.During each iteration, the assignment to d m produces a final diagonal element.On the last iteration, when m = 2, the assignment to d m−1 also produces a final diagonal element at the top.
Note when b m = 0, the algorithm does nothing and moves to the next step.Also note that the values in b can change.In each iteration, the algorithm executes one of the five subcases.It should be noted that subcase 1a and subcase 2b are the normal cases, and the other three subcases represent singularities.Executing subcase 1b requires x = 1, executing subcase 2a requires x = 0, and executing subcase 1c requires α + x = 2.The following theorem, whose proof appears in [8], asserts the correctness of the algorithm.
Theorem 1 For inputs G and x, where G is a threshold graph with adjacency matrix A, algorithm Diagonalize computes a diagonal matrix D, which is congruent to A + xI.

Symbolic algorithm
The characteristic polynomial is obtained by computing det(xI n − A), where x is an indeterminate.This can be done by diagonalizing A − xI n , multiplying the diagonal elements, and then adjusting the sign.Algorithm Diagonalize Algorithm Diagonalize(G, x) Proof: Since x is an indeterminate, x = 0, 1.
During the execution of Diagonalize(G, −x) there is a sequence of n elements of R(x), calculated right to left α n−1 (x), . . ., α 1 (x), α 0 (x) = −x that are temporarily assigned to the diagonal.We call it the α-sequence.Except for the final value α n−1 , each gets overwritten.When the algorithm executes subcase 1a, we have: JGAA, 18(5) 709-719 (2014) 713 When the algorithm executes subcase 2b, Lemma 2 Assume Diagonalize(G, −x) executes only subcase 1a and subcase 2b for its first j steps.Then for each i ≤ j, α i (x) = p(x) q(x) , where p(x) and q(x) are polynomials such that 1. deg(p) = deg(q) + 1; 2. p(x) has a negative leading coefficient; 3. q(x) has a positive leading coefficient.Proof: By induction on i.When i = 0, we have α 0 (x) = −x 1 .So assume α i can be written as p(x) q(x) having these three properties, and consider α i+1 .There are two cases, according to whether subcase 1a or subcase 2b occured in the last iteration.subcase 1a Then (1) holds, and we have Using the induction assumption, we see that the degree and leading coefficient properties are preserved.subcase 2b Then (2) holds, and we have . Using the induction assumption, we see that the degree and leading coefficient properties are also preserved.This completes the proof.
Lemma 3 During the execution of Diagonalize(G, −x), it is impossible for the algorithm to enter subcase 1c.
Proof: Suppose, by contradiction, the algorithm enters subcase 1c.Then it must be the case, that for some i, α i (x) = 2 + x.Assume this is the first such i.By Lemma 2 lim This is a contradiction.It follows from Lemma 1 and Lemma 3 that Diagonalize(G, −x) can only execute subcase 1a or subcase 2b.The simplified algorithm is shown in Figure 3, and there is no modification of the b i required.After diagonalization, the determinant is computed by multiplying the diagonal terms and adjusting the sign.We have: Algorithm CharPoly makes O(n) polynomial arithmetic operations.As the proof of Lemma 2 shows, those operations inside the loop are simple and each can be done in linear time.The final product involves multiplying n rational functions.Using fast polynomial arithmetic, each multiplication will take O(n log n), so the running time is O(n 2 log n).By constructing the partial product inside the loop, only O(n) space is required.

Equitable partition approach
We mention that there is an alternate approach for computing the characteristic polynomial of a threshold graph G, that uses a reduction procedure, and takes into account the multiplicity of the eigenvalues 0 and −1.We refer the reader to [2,9,12,13,14] for details, and summarize the results important to our discussion.Let G be a threshold graph with creation sequence where b 1 = 0 and b n = 1.Then 1. the multiplicity of 0 is the number of substrings 00 in b.