Constructing Linear-Sized Spectral Sparsification in Almost-Linear Time
Yin Tat Lee, He Sun
Introduction
Graph sparsification is the procedure of approximating a graph by a sparse graph such that certain quantities between and are preserved. For instance, spanners are defined between two graphs in which the distances between any pair of vertices in these two graphs are approximately the same ; cut sparsifiers are reweighted sparse graphs of the original graphs such that the weights of every cut between the sparsifiers and the original graphs are approximatedly the same . Since both storing and processing large-scale graphs are expensive, graph sparsification is one of the most fundamental building blocks in designing fast graph algorithms, including solving Laplacian systems , designing approximation algorithms for the maximum flow problem , and solving streaming problems . Beyond graph problems, techniques developed for spectral sparsification are widely used in randomized linear algebra , sparsifying linear programs , and various pure mathematics problems .
where and are the respective graph Laplacian matrices of and .
Spielman and Teng presented the first algorithm for constructing spectral sparsification. For any undirected graph of vertices, their algorithm runs in time, for some big constant , and produces a spectral sparsifier with edges for some . Since then, there has been a wealth of work on spectral sparsification. For instance, Spielman and Srivastava presented a nearly-linear time algorithm for constructing a spectral sparsifier of edges. Batson, Spielman and Srivastava presented an algorithm for constructing spectral sparsifiers with edges, which is optimal up to a constant. However, all previous constructions either require time in order to produce linear-sized sparsifiers , or time but the number of edges in the sparsifiers is sub-optimal.
In this paper we present the first almost-linear time algorithm for constructing linear-sized spectral sparsification for graphs. Our result is summarized as follows:
Given any integer and . Let be an undirected and weighted graph with vertices and edges. Then, there is an algorithm that outputs a -spectral sparsifier of with edges. The algorithm runs in time.
Graph sparsification is known as a special case of sparsifying sums of rank-1 positive semi-definite (PSD) matrices , and our algorithm works in this general setting as well. Our result is summarized as follows:
Given any integer and . Let be the sum of rank-1 PSD matrices. Then, there is an algorithm that outputs scalers with such that
The algorithm runs in time, where is the matrix-multiplication constant.
A key ingredient in our algorithm is a novel combination of two techniques used in literature for constructing spectral sparsification: Random sampling by effective resistance of edges , and adaptive construction based on barrier functions . We will present an overview of the algorithm, and the intuitions behind it in Section 2.
Algorithm
We study the algorithm of sparsifying the sum of rank-1 PSD matrices in this section. Our goal is to, for any vectors with , find scalars satisfying
We will use this algorithm to construct graph sparsifiers in Section 3.
Our construction is based on a probabilistic view of the algorithm presented in Batson et al. . We refer their algorithm BSS for short, and give a brief overview of the BSS algorithm at first.
always holds, . To guarantee this, Batson et al. introduces a potential function
The original BSS algorithm is deterministic, and in each iteration the algorithm finds a rank-1 matrix which maximizes certain quantities. To informally explain our algorithm, let us look at the following randomized variant of the BSS algorithm: In each iteration, we choose a vector with probability , and add a rank-1 matrix
to the current matrix . See Algorithm 1 for formal description.
where we used the fact that for any vector and PSD matrix . Similarly, we have that
Our algorithm follows the same framework as Algorithm 1. However, to construct a spectral sparsifier in almost-linear time, we expect that the sampling probability of vectors (i) can be approximately computed fast, and (ii) can be further “reused” for a few iterations.
For fast approximation of the sampling probabilities, we adopt the idea proposed in : Instead of defining the potential function by (2.2), we define the potential function by
To “reuse” the sampling probabilities, we re-compute after every iterations: We show that as long as the sampling probability satisfies
for some constant , we can still sample with probability and get the same guarantee on the potential function. The reason is as follows: Assume that is the sum of the sampled matrices within iterations. If a randomly chosen matrix satisfies , then by the matrix Chernoff bound holds with high probability. By scaling every sampled rank-1 matrix times smaller, the sampling probability only changes by a constant factor within iterations. Since we choose vectors in total, our algorithm only recomputes the sampling probabilities times. Hence, our algorithm runs in almost-linear time if is a large constant.
2 Algorithm Description
The algorithm follows the same framework as Algorithm 1, and proceeds by iterations. Initially, the algorithm sets
holds for any . In iteration , the algorithm computes the relative effective resistance of vectors defined by
We remark that, although exact values of and relative effective resistances are difficult to compute in almost-linear time, we can use approximated values of and instead. It is easy to see that in each iteration an over estimate of , and an under estimate of with constant-factor approximation suffice for our purpose.
Analysis
We analyze Algorithm 2 in this section. To make the calculation less messy, we assume the following:
We always assume that , and is an integer satisfying .
We will show how the potential function evolves after each iteration in Section 3.1. Combing this with the ending condition of the algorithm, we will prove in Section 3.2 that the algorithm outputs a linear-sized spectral sparsifier. We will prove Theorem 1.1 and Theorem 1.2 in Section 3.3.
Assume that the number of samples satisfies
By the description of the sampling procedure, it holds that
and . Moreover, it holds that
it holds by the Matrix Chernoff Bound (cf. Lemma 3.2) that
where the last inequality follows from the condition on . Hence, with probability at least
which implies that and . ∎
Now we analyze the change of the potential function after each iteration, and show that the expected value of the potential function decreases over time. By Lemma 3.3, with probability at least , it holds that
Lemma 3.4 below shows how the potential function changes after each iteration, and plays a key role in our analysis. This lemma was first proved in for the case of , and was extended in to general values of . For completeness, we include the proof of the lemma in the appendix.
Let be the matrices picked in iteration , and define for any that
We study the change of the potential function after adding a rank-1 matrix within each iteration. For this reason, we use
Assuming , we claim that
for any . Based on this, we apply Lemma 3.4 and get that
Putting (3.4) and (3.5) together, we have that
So, it suffices to prove the claim (3.3). Since for any vector and PSD matrix , we have that
By the assumption of , it holds that
This proves the first statement of the claim.
2 Analysis of the Approximation Guarantee
In this subsection we will prove that the algorithm produces a linear-sized -spectral sparsifier. We assume that the algorithm finishes after iterations, and will prove that the output is a -spectral sparsifier. It suffices to show that the condition number of is small, which follows directly from our setting of parameters.
The output matrix has condition number at most .
Since the condition number of is at most
Now we prove that the algorithm finishes in iterations, and picks vectors in total.
With probability at least , the algorithm finishes in iterations.
With probability at least , the algorithm chooses at most vectors.
Since the algorithm finishes within iterations if
where the last inequality follows from the fact that
By Lemma 3.3, every picked matrix in iteration satisfies
with probability at least , and with probability all matrices picked in iterations satisfy the condition above. Also, by Lemma 3.5 we have that
since the initial value of the potential function is at most 1. Therefore, it holds that
where the second last inequity follows from Markov’s inequality and (3.6), and the last inequality follows by our choice of . This proves the first statement.
Let be the vectors sampled by the algorithm, and is picked in iteration , where . We first assume that the algorithm could check the ending condition after adding every single vector. In such case, it holds that
Following the same proof as the first part and noticing that in the final iteration the algorithm chooses at most extra vectors, we obtain the second statement. ∎
3 Proof of the Main Results
Now we analyze the runtime of the algorithm, and prove the main results. We first analyze the algorithm for sparsifying sums of rank-1 PSD matrices, and prove Theorem 1.2.
By Lemma 3.7, with probability at least the algorithm chooses at most vectors, and by Lemma 3.6 the condition number of is at most , implying that the matrix is a -approximation of . These two results together prove that is a linear-sized spectral sparsifier.
For the runtime, Lemma 3.7 proves that the algorithm finishes in iterations, and it is easy to see that all the required quantities in each iteration can be approximately computed in time using fast matrix multiplication. Therefore, the total runtime of the algorithm is . ∎
Next we show how to apply our algorithm in the graph setting, and prove Theorem 1.1. Let be the Laplacian matrix of an undirected graph , where is the Laplacian matrix of the graph consisting of a single edge . By setting
for , it is easy to see that constructing a spectral sparsifier of is equivalent to sparsifing the matrix . We will present in the appendix almost-linear time algorithms to approximate the required quantities
in each iteration, and this gives Theorem 1.1.
By applying the same analysis as in the proof of Theorem 1.2, we know that the output matrix is a linear-sized spectral sparsifier, and it suffices to analyze the runtime of the algorithm.
By Lemma 3.3 and the Union Bound, with probability at least all the matrices picked in iterations satisfy
On the other hand, notice that it holds for any that
Hence, we apply Lemma 4.5 and Lemma 4.6 to compute all required quantities in each iteration up to constant approximation in time
Since by Lemma 3.7 the algorithm finishes in iterations with probability at least , the total runtime of the algorithm is
Acknowledgment
This work was partially supported by NSF awards 0843915 and 1111109. Part of this work was done while both authors were visiting the Simons Institute for the Theory of Computing, UC Berkeley, and the second author was affiliated with the Max Planck Institute for Informatics, Germany. We thank Zeyuan Allen-Zhu, Zhenyu Liao, and Lorenzo Orecchia for sending us their manuscript of and the inspiring talk Zeyuan Allen-Zhu gave at the Simons Institute for the Theory of Computing. Finally, we thank Michael Cohen for pointing out a gap in a previous version of the paper and his fixes for the gap, as well as Lap-Chi Lau for many insightful comments on improving the presentation of the paper.
References
Omitted Proofs
In this subsection we prove Lemma 3.4. We first list the following two lemmas, which will be used in our proof.
Let and be positive definite matrices, and . Then it holds that
By the assumption of , we have that
Note that , and
Now for the second inequality. Let . By the Sherman-Morrison Formula (Lemma 4.1), it holds that
By the assumption of , it holds that
Combing with the assumption that and , we have that
2 Implementation of the Algorithm
Let and be the Laplacian matrices of graph and its subgraph after reweighting. Let , and assume that
Under Assumption 4.3, the following statements hold:
We can construct a matrix such that
and for a polynomial of degree .
since . Notice that , and therefore
Setting for some constant and defining gives us that
Using the same analysis as before, we have that
Let , and suppose that satisfies Assumption 4.3. Then, we can compute and in time such that
Define for any . By Lemma 4.4, we have that
We apply a nearly-linear time Laplacian solver to compute for all up to -multiplicative error in time . This gives the desired .
The computation for is similar. By Lemma 4.4, it holds for any that
We invoke the Johnson-Lindenstrauss Lemma and a nearly-linear time Laplacian solver as before to obtain required . The total runtime is . ∎
Under Assumption 4.3, we can compute values in time such that
By Lemma 4.4, we have that . Hence, , and it suffices to estimate . Since
Let be a polynomial defined by and . Then, we have that
Applying the same analysis as before, we can estimate the trace in time. ∎