Graph Sparsification by Effective Resistances

Daniel A. Spielman, Nikhil Srivastava

Introduction

The goal of sparsification is to approximate a given graph GG by a sparse graph HH on the same set of vertices. If HH is close to GG in some appropriate metric, then HH can be used as a proxy for GG in computations without introducing too much error. At the same time, since HH has very few edges, computation with and storage of HH should be cheaper.

We study the notion of spectral sparsification introduced by Spielman and Teng . Spectral sparsification was inspired by the notion of cut sparisification introduced by Benczúr and Karger to accelerate cut algorithms whose running time depends on the number of edges. They gave a nearly-linear time procedure which takes a graph GG on nn vertices with mm edges and a parameter ϵ>0\epsilon>0, and outputs a weighted subgraph HH with O(nlog⁡n/ϵ2)O(n\log n/\epsilon^{2}) edges such that the weight of every cut in HH is within a factor of (1±ϵ)(1\pm\epsilon) of its weight in GG. This was used to turn Goldberg and Tarjan’s O~(mn)\widetilde{O}(mn) max-flow algorithm into an O~(n2)\widetilde{O}(n^{2}) algorithm for approximate stst-mincut, and appeared more recently as the first step of an O~(n3/2+m)\widetilde{O}(n^{3/2}+m)-time O(log⁡2n)O(\log^{2}n) approximation algorithm for sparsest cut .

In this work, we construct sparsifiers that achieve the same guarantee as Spielman and Teng’s but with O(nlog⁡n/ϵ2)O(n\log n/\epsilon^{2}) edges, thus improving on both and . Our sparsifiers are subgraphs of the original graph and can be computed in O~(m)\widetilde{O}(m) time by random sampling, where the sampling probabilities are given by the effective resistances of the edges. While this is conceptually much simpler than the recursive partitioning approach of , we need to solve O(log⁡n)O(\log n) linear systems to compute the effective resistances quickly, and we do this using Spielman and Teng’s linear equation solver.

Our main idea is to include each edge of GG in the sparsifier HH with probability proportional to its effective resistance. The effective resistance of an edge is known to be equal to the probability that the edge appears in a random spanning tree of GG (see, e.g., or ), and was proven in to be proportional to the commute time between the endpoints of the edge. We show how to approximate the effective resistances of edges in GG quickly and prove that sampling according to these approximate values yields a good sparsifier.

To define effective resistance, identify G=(V,E,w)G=(V,E,w) with an electrical network on nn nodes in which each edge ee corresponds to a link of conductance wew_{e} (i.e., a resistor of resistance 1/we1/w_{e}). Then the effective resistance ReR_{e} across an edge ee is the potential difference induced across it when a unit current is injected at one end of ee and extracted at the other end of ee. Our algorithm can now be stated as follows.

Sparsifiers that satisfy this condition preserve many properties of the graph. The Courant-Fischer Theorem tells us that

and the eigenspaces spanned by corresponding eigenvalues are related. As the eigenvalues of the normalized Laplacian are given by

and are the same as the eigenvalues of the walk matrix D−1LD^{-1}L, we obtain the same relationship between the eigenvalues of the walk matrix of the original graph and its sparsifier. Many properties of graphs and random walks are known to be revealed by their spectra (see for example ). The existence of sparse subgraphs which retain these properties is interesting its own right; indeed, expander graphs can be viewed as constant degree sparsifiers for the complete graph.

We remark that the condition (2) also implies

where L+L^{+} is the pseudoinverse of LL. Thus sparsifiers also approximately preserve the effective resistances between vertices, since for vertices uu and vv, the effective resistance between them is given by the formula (χu−χv)TL+(χu−χv)(\chi_{u}-\chi_{v})^{T}L^{+}(\chi_{u}-\chi_{v}), where χu\chi_{u} is the elementary unit vector with a coordinate 1 in position uu.

We prove Theorem 1 in Section 3. At the end of Section 3, we prove that the spectral guarantee (2) of Theorem 1 is not harmed too much if use approximate effective resistances for sampling instead of exact ones(Corollary 6).

In Section 4, we show how to compute approximate effective resistances in nearly-linear time, which is essentially optimal. The tools we use to do this are Spielman and Teng’s nearly-linear time solver and the Johnson-Lindenstrauss Lemma . Specifically, we prove the following theorem, in which RuvR_{uv} denotes the effective resistance between vertices uu and vv.

There is an O~(m(log⁡r)/ϵ2)\widetilde{O}(m(\log r)/\epsilon^{2}) time algorithm which on input ϵ>0\epsilon>0 and G=(V,E,w)G=(V,E,w) with r=wmax/wminr=w_{max}/w_{min} computes a (24log⁡n/ϵ2)×n(24\log n/\epsilon^{2})\times n matrix Z~\widetilde{Z} such that with probability at least 1−1/n1-1/n

Since Z~(χu−χv)\widetilde{Z}(\chi_{u}-\chi_{v}) is simply the difference of the corresponding two columns of Z~\widetilde{Z}, we can query the approximate effective resistance between any pair of vertices (u,v)(u,v) in time O(log⁡n/ϵ2)O(\log n/\epsilon^{2}), and for all the edges in time O(mlog⁡n/ϵ2)O(m\log n/\epsilon^{2}). By Corollary 6, this yields an O~(m(log⁡r)/ϵ2)\widetilde{O}(m(\log r)/\epsilon^{2}) time for sparsifying graphs, as advertised.

In Section 5, we show that HH can be made close to GG in some additional ways which make it more useful for preconditioning systems of linear equations.

2 Related Work

Batson, Spielman, and Srivastava have given a deterministic algorithm that constructs sparsifiers of size O(n/ϵ2)O(n/\epsilon^{2}) in O(mn3/ϵ2)O(mn^{3}/\epsilon^{2}) time. While this is too slow to be useful in applications, it is optimal in terms of the tradeoff between sparsity and quality of approximation and can be viewed as generalizing expander graphs. Their construction parallels ours in that it reduces the task of spectral sparsification to approximating the matrix Π\Pi defined in Section 3; however, their method for selecting edges is iterative and more delicate than the random sampling described in this paper.

The use of effective resistance as a distance in graphs has recently gained attention as it is often more useful than the ordinary geodesic distance in a graph. For example, in small-world graphs, all vertices will be close to one another, but those with a smaller effective resistance distance are connected by more short paths. See, for instance , which use effective resistance/commute time as a distance measure in social network graphs.

Preliminaries

Let G=(V,E,w)G=(V,E,w) be a connected weighted undirected graph with nn vertices and mm edges and edge weights we>0w_{e}>0. If we orient the edges of GG arbitrarily, we can write its Laplacian as L=BTWBL=B^{T}WB, where Bm×nB_{m\times n} is the signed edge-vertex incidence matrix, given by

It is immediate that LL is positive semidefinite since

We also have ker⁡(L)=ker⁡(W1/2B)=span(1)\ker(L)=\ker(W^{1/2}B)=\textrm{span}(\mathbf{1}), since

2 The Pseudoinverse

Since LL is symmetric we can diagonalize it and write

where λ1,…,λn−1\lambda_{1},\ldots,\lambda_{n-1} are the nonzero eigenvalues of LL and u1,…,un−1u_{1},\ldots,u_{n-1} are a corresponding set of orthonormal eigenvectors. The Moore-Penrose Pseudoinverse of LL is then defined as

Notice that ker⁡(L)=ker⁡(L+)\ker(L)=\ker(L^{+}) and that

3 Electrical Flows

Begin by arbitrarily orienting the edges of GG as in Section 2.1. We will use the same notation as to describe electrical flows on graphs: for a vector iext(u)\mathbf{i_{\textrm{ext}}}(u) of currents injected at the vertices, let i(e)\mathbf{i}(e) be the currents induced in the edges (in the direction of orientation) and v(u)\mathbf{v}(u) the potentials induced at the vertices. By Kirchoff’s current law, the sum of the currents entering a vertex is equal to the amount injected at the vertex:

By Ohm’s law, the current flow in an edge is equal to the potential difference across its ends times its conductance:

by the definition of L+L^{+} in Section 2.2.

Recall that the effective resistance between two vertices uu and vv is defined as the potential difference induced between them when a unit current is injected at one and extracted at the other. We will derive an algebraic expression for the effective resistance in terms of L+L^{+}. To inject and extract a unit current across the endpoints of an edge e=(u,v)e=(u,v), we set iext=beT=(χv−χu)\mathbf{i_{\textrm{ext}}}=b_{e}^{T}=(\chi_{v}-\chi_{u}), which is clearly orthogonal to 1\mathbf{1}. The potentials induced by iext\mathbf{i_{\textrm{ext}}} at the vertices are given by v=L+beT\mathbf{v}=L^{+}b_{e}^{T}; to measure the potential difference across e=(u,v)e=(u,v), we simply multiply by beb_{e} on the left:

It follows that the effective resistance across ee is given by beL+beTb_{e}L^{+}b_{e}^{T} and that the matrix BL+BTBL^{+}B^{T} has as its diagonal entries BL+BT(e,e)=ReBL^{+}B^{T}(e,e)=R_{e}.

The Main Result

We will prove Theorem 1. Consider the matrix Π=W1/2BL+BTW1/2\Pi=W^{1/2}BL^{+}B^{T}W^{1/2}. Since we know BL+BT(e,e)=ReBL^{+}B^{T}(e,e)=R_{e}, the diagonal entries of Π\Pi are Π(e,e)=W(e,e)ReW(e,e)=weRe\Pi(e,e)=\sqrt{W(e,e)}R_{e}\sqrt{W(e,e)}=w_{e}R_{e}. Π\Pi has some notable properties.

(iv) follows from Π2(e,e)=Π(⋅,e)TΠ(⋅,e)\Pi^{2}(e,e)=\Pi(\cdot,e)^{T}\Pi(\cdot,e), since Π\Pi is symmetric. ∎

We may describe the outcome of H=Sparsify(G,q)H=\mathbf{Sparsify}(G,q) by the following random matrix:

Suppose SS is a nonnegative diagonal matrix such that

To show that ∥ΠSΠ−ΠΠ∥2\|\Pi S\Pi-\Pi\Pi\|_{2} is likely to be small we use the following concentration result, which is a sort of law of large numbers for symmetric rank 1 matrices. It was first proven by Rudelson in , but the version we state here appears in the more recent paper by Rudelson and Vershynin.

We can now finish the proof of Theorem 1.

Sparsify\mathbf{Sparsify} samples edges from GG independently with replacement, with probabilities pep_{e} proportional to weRew_{e}R_{e}. Since ∑eweRe=Tr(Π)=n−1\sum_{e}w_{e}R_{e}=\textrm{Tr}(\Pi)=n-1 by Lemma 3.(iii), the actual probability distribution over EE is given by pe=weRen−1p_{e}=\frac{w_{e}R_{e}}{n-1}. Sampling qq edges from GG corresponds to sampling qq columns from Π\Pi, so we can write

for vectors y1,…,yqy_{1},\ldots,y_{q} drawn independently with replacement from the distribution

We can now apply Lemma 5. The expectation of yyTyy^{T} is given by

Taking q=9C2nlog⁡n/ϵ2q=9C^{2}n\log n/\epsilon^{2} gives:

for nn sufficiently large, as ϵ\epsilon is assumed to be at least 1/n1/\sqrt{n}.

with probability at least 1/21/2. By Lemma 4, this completes the proof of the theorem. ∎

We now show that using approximate resistances for sampling does not damage the sparsifier very much.

Suppose ZeZ_{e} are numbers satisfying Ze≥Re/αZ_{e}\geq R_{e}/\alpha and ∑eweZe≤α∑eweRe\sum_{e}w_{e}Z_{e}\leq\alpha\sum_{e}w_{e}R_{e} for some α≥1\alpha\geq 1. If we sample as in Sparsify\mathbf{Sparsify} but take each edge with probability pe′=weZe∑eweZep_{e}^{\prime}=\frac{w_{e}Z_{e}}{\sum_{e}w_{e}Z_{e}} instead of pe=weRe∑eweRep_{e}=\frac{w_{e}R_{e}}{\sum_{e}w_{e}R_{e}}, then HH satisfies:

and proceed as in the proof of Theorem 1. The norm of the random vector yy is now bounded by:

which introduces a factor of α\alpha into the final bound on the expectation, but changes nothing else.∎

Computing Approximate Resistances Quickly

It is not clear how to compute all the effective resistances {Re}\{R_{e}\} exactly and efficiently. In this section, we show that one can compute constant factor approximations to all the ReR_{e} in time O~(mlog⁡r)\widetilde{O}(m\log r). In fact, we do something stronger: we build a O(log⁡n)×nO(\log n)\times n matrix Z~\widetilde{Z} from which the effective resistance between any two vertices (including vertices not connected by an edge) can be computed in O(log⁡n)O(\log n) time.

If uu and vv are vertices in GG, then the effective resistance between uu and vv can be written as:

Thus effective resistances are just pairwise distances between vectors in {W1/2BL+χv}v∈V\{W^{1/2}BL^{+}\chi_{v}\}_{v\in V}. By the Johnson-Lindenstrauss Lemma, these distances are preserved if we project the vectors onto a subspace spanned by O(log⁡n)O(\log n) random vectors. For concreteness, we use the following version of the Johnson-Lindenstrauss Lemma due to Achlioptas .

Our goal is now to compute the projections {QW1/2BL+χv}\{QW^{1/2}BL^{+}\chi_{v}\}. We will exploit the linear system solver of Spielman and Teng , which we recall satisfies:

There is an algorithm x=STSolve(L,y,δ)x=\mathtt{STSolve}(L,y,\delta) which takes a Laplacian matrix LL, a column vector yy, and an error parameter δ>0\delta>0, and returns a column vector xx satisfying

where ∥y∥L=yTLy\left\|y\right\|_{L}=\sqrt{y^{T}Ly}. The algorithm runs in expected time O~(mlog⁡(1/δ))\widetilde{O}\left(m\log(1/\delta)\right), where mm is the number of non-zero entries in LL.

Let QQ be a random ±1/k\pm 1/\sqrt{k} matrix of dimension k×nk\times n where k=24log⁡n/ϵ2k=24\log n/\epsilon^{2}.

Compute Y=QW1/2BY=QW^{1/2}B. Note that this takes 2m×24log⁡n/ϵ2+m=O~(m/ϵ2)2m\times 24\log n/\epsilon^{2}+m=\widetilde{O}(m/\epsilon^{2}) time since BB has 2m2m entries and W1/2W^{1/2} is diagonal.

We now prove that, for our purposes, it suffices to call STSolve with

for every pair u,v∈Vu,v\in V. If for all ii,

Consider an arbitrary pair of vertices uu, vv. It suffices to show that

As GG is connected, there is a simple path PP connecting uu to vv. Applying the triangle inequality twice, we obtain

We will upper bound this later term by considering its square:

by Proposition 10. Combining these bounds, we have

If G=(V,E,w)G=(V,E,w) is a connected graph, then for all u,v∈Vu,v\in V,

By Rayleigh’s monotonicity law (see ), each resistance RuvR_{uv} in GG is at least the corresponding resistance Ruv′R_{uv}^{\prime} in G′=wmax×KnG^{\prime}=w_{{max}}\times K_{n} (the complete graph with all edge weights wmaxw_{{max}}) since G′G^{\prime} is obtained by increasing weights (i.e., conductances) of edges in GG. But by symmetry each resistance Ruv′R_{uv}^{\prime} in G′G^{\prime} is exactly

Thus Ruv≥2nwmaxR_{uv}\geq\frac{2}{nw_{{max}}} for all u,v∈Vu,v\in V. ∎

Thus the construction of Z~\widetilde{Z} takes O~(mlog⁡(1/δ)/ϵ2)=O~(mlog⁡r/ϵ2)\widetilde{O}(m\log(1/\delta)/\epsilon^{2})=\widetilde{O}(m\log r/\epsilon^{2}) time. We can then find the approximate resistance ∥Z~(χu−χv)∥2≈Ruv\|\widetilde{Z}(\chi_{u}-\chi_{v})\|^{2}\approx R_{uv} for any u,v∈Vu,v\in V in O(log⁡n/ϵ2)O(\log n/\epsilon^{2}) time simply by subtracting two columns of Z~\widetilde{Z} and computing the norm of their difference. ∎

Using the above procedure, we can compute arbitrarily good approximations to the effective resistances {Re}\{R_{e}\} which we need for sampling in nearly-linear time. By Corollary 6, any constant factor approximation yields a sparsifier, so we are done.

An Additional Property

Corollary 6 suggests that Sparsify\mathbf{Sparsify} is quite robust with respect to changes in the sampling probabilities pep_{e}, and that we may be able to prove additional guarantees on HH by tweaking them. In this section, we prove one such claim.

The following property is desirable for using HH to solve linear systems (specifically, for the construction of ultrasparsifiers , which we will not define here):

This says, roughly, that not too many of the edges incident to any given vertex get blown up too much by sampling and rescaling. We show how to incorporate this property into our sparsifiers.

Suppose we sample q>4nlog⁡n/βq>4n\log n/\beta edges of GG as in Sparsify\mathbf{Sparsify} with probabilities that satisfy

for some constant 0<β<10<\beta<1. Then with probability at least 1−1/n1-1/n,

For a vertex vv, define i.i.d. random variables X1,…,XqX_{1},\ldots,X_{q} by:

so that XiX_{i} is set to 1/pe1/p_{e} with probability pep_{e} for each edge ee attached to vv. Let

We want to show that with high probability, Dv≤2deg⁡(v)D_{v}\leq 2\deg(v) for all vertices vv. We begin by bounding the expectation and variance of each XiX_{i}:

Since the XiX_{i} are independent, the variance of DvD_{v} is just

We now apply Bennett’s inequality for sums of i.i.d. variables (see, e.g., ), which says

Taking a union bound over all vv gives the desired result.∎

satisfies the requirements of both Corollary 6 (with α=2\alpha=2) and Lemma 11 (with β=1/2\beta=1/2) and yields a sparsifier with the desired property.

References