A fast new algorithm for weak graph regularity
aa r X i v : . [ m a t h . C O ] J a n A FAST NEW ALGORITHM FOR WEAK GRAPH REGULARITY
JACOB FOX, L ´ASZL ´O MIKL ´OS LOV ´ASZ, AND YUFEI ZHAO
Abstract.
We provide a deterministic algorithm that finds, in ǫ − O (1) n time, an ǫ -regular Frieze–Kannan partition of a graph on n vertices. The algorithm outputs an approximation of a givengraph as a weighted sum of ǫ − O (1) many complete bipartite graphs.As a corollary, we give a deterministic algorithm for estimating the number of copies of H in an n -vertex graph G up to an additive error of at most ǫn v ( H ) , in time ǫ − O H (1) n . Introduction
The regularity method, based on Szemer´edi’s regularity lemma [18], is one of the most powerfultools in graph theory. Szemer´edi [17] used an early version in the proof of his celebrated theoremon long arithmetic progressions in dense subsets of the integers. Roughly speaking, the regularitylemma says that every large graph can be partitioned into a small number of parts such that thebipartite subgraph between almost every pair of parts is random-like. One of the main drawbacksof the original regularity lemma is that it requires a tower-type number of parts, where the heightof the tower depends on an error parameter ǫ . However, for many applications, the full power ofthe regularity lemma is not needed, and a weaker notion of Frieze-Kannan regularity suffices.To state the regularity lemmas requires some terminology. Let G be a graph, and X and Y be (notnecessarily disjoint) vertex subsets. Let e ( X, Y ) denote the number of pairs vertices ( x, y ) ∈ X × Y that are edges of G . The edge density d ( X, Y ) = e ( X, Y ) / ( | X || Y | ) between X and Y is the fractionof pairs in X × Y that are edges. The pair ( X, Y ) is ǫ -regular if for all X ′ ⊆ X and Y ′ ⊆ Y with | X ′ | ≥ ǫ | X | and | Y ′ | ≥ ǫ | Y | , we have | d ( X ′ , Y ′ ) − d ( X, Y ) | < ǫ . Qualitatively, a pair of parts is ǫ -regular with small ǫ if the edge densities between pairs of large subsets are all roughly the same.A vertex partition V = V ∪ . . . ∪ V k is equitable if the parts have size as equal as possible, that iswe have || V i | − | V j || ≤ i, j . An equitable vertex partition with k parts is ǫ -regular if all but ǫk pairs of parts ( V i , V j ) are ǫ -regular. The regularity lemma states that for every ǫ > K ( ǫ ) such that every graph has an ǫ -regular equitable vertex partition into at most K ( ǫ ) parts.To state Frieze-Kannan regularity precisely, first, we extend the definition of e ( X, Y ) and d ( X, Y )to weighted graphs. Below by weighted graph we mean a graph with edge-weights. Given two setsof vertices X and Y , we let e ( X, Y ) denote the sum of the edge-weights over pairs ( x, y ) ∈ X × Y (taking 0 if a pair does not have an edge). Let d ( X, Y ) = e ( X, Y ) / ( | X || Y | ) as earlier. Recall thatthe cut metric d (cid:3) between two graphs G and H on the same vertex set V = V ( G ) = V ( H ) isdefined by d (cid:3) ( G, H ) := max
U,W ⊆ V | e G ( U, W ) − e H ( U, W ) || V | , Date : January 20, 2018.2010
Mathematics Subject Classification. and this extends to graphs with weighted edges, and can be adapted to bipartite graphs (with givenbipartitions). Given any edge-weighted graph G and any partition P : V = V ∪ V ∪ · · · ∪ V t ofthe vertex set of G into t parts, let G P denote the weighted graph with vertex set V obtained bygiving weight d ij := d ( V i , V j ) to all pairs of vertices in V i × V j , for every 1 ≤ i ≤ j ≤ t . We say P is an ǫ -regular Frieze–Kannan (or ǫ -FK-regular ) partition if d (cid:3) ( G, G P ) ≤ ǫ . In other words, P isan ǫ -regular Frieze–Kannan partition if (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) e ( S, T ) − t X i,j =1 d ij | S ∩ V i || T ∩ V j | (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≤ ǫ | V | . (1)for all S, T ⊆ V . We say that sets S and T witness that P is not ǫ -FK-regular if the above inequalityis violated.Frieze and Kannan [7, 8] proved the following regularity lemma. Theorem 1.1 (Frieze–Kannan) . Let ǫ > . Every graph has an ǫ -regular Frieze–Kannan partitionwith at most /ǫ parts. There is a variant of the weak regularity lemma, where the final output is not a partition of V into 2 ǫ − O (1) parts, but rather an approximation of the graphs as a sum of ǫ − O (1) complete bipartitegraphs, each assigned some (not necessarily nonnegative) weight, see [8]. For S, T ⊆ V , we denoteby K S,T the weighted graph where an edge { s, t } has weight 1 if s ∈ S and t ∈ T (and weight 2 if s, t ∈ S ∩ T ) and weight zero otherwise. For any c ∈ R , by cG we mean the weighted graph obtainedfrom G by multiplying every edge-weight by c . For a pair of weighted graphs G , G on the sameset of vertices, we will use the notation G + G to denote the graph on the same vertex set withedge weights summed (and weight 0 corresponding to not having an edge). Additionally, we write c to mean the constant graph with all edge-weights equal to c . We also use d ( G ) := d ( V ( G ) , V ( G ))to denote the edge density of the weighted graph G . Theorem 1.2 (Frieze–Kannan) . Let ǫ > . Let G be any weighted graph with [ − , -valuededge weights. There exists an r = O ( ǫ − ) , and there exist subsets S , . . . , S r , T , . . . , T r ⊆ V , and c , . . . , c k ∈ [ − , , so that d (cid:3) ( G, d ( G ) + c K S ,T + · · · + c r K S r ,T r ) ≤ ǫ. See [11, Lemma 4.1] for a simple proof (given there in a more general setting of arbitrary Hilbertspaces). It is well known using the triangle inequality (see, e.g., [8]) that given sets and numbers asin the theorem, the common refinement of all S i , T i must be a 2 ǫ -regular Frieze-Kannan partition.In addition to proving that a partition or “cut graph decomposition” exists, Frieze and Kannangave probabilistic algorithms for finding a weak regular partition [7, 8] or decomposition. Twodeterministic algorithms were given by Dellamonica, Kalyanasundaram, Martin, R¨odl, and Shapira[2, 3]. Specifically, in [2], the authors gave an ǫ − n ω + o (1) time algorithm ( ω < .
373 is the matrixmultiplication exponent) to generate an equitable ǫ -regular Frieze–Kannan partition of a graph on n vertices into at most 2 O ( ǫ − ) parts. In [3] a different algorithm was given which improved thedependence of the running time on n from O ǫ ( n ω + o (1) ) to O ǫ ( n ), while sacrificing the dependenceof ǫ . Namely, it was shown that there is a deterministic algorithm that finds, in 2 ǫ − O (1) n time,an ǫ -regular Frieze–Kannan partition into at most 2 ǫ − O (1) parts.In Section 2, we give an optimal algorithm that provides the best of both worlds: We give analgorithm that finds, in ǫ − O (1) n time, a weakly regular partition. In fact, we provide an algorithmfor finding a cut graph decomposition, which is more useful in some applications. The algorithm isalso self-contained. Theorem 1.3 replaces [6, Corollary 3.5], which we retracted [5].
FAST NEW ALGORITHM FOR WEAK GRAPH REGULARITY 3
Theorem 1.3.
There is a deterministic algorithm that, given ǫ > and an n -vertex graph G ,outputs, in ǫ − O (1) n time, subsets S , S , ..., S r , T , T , ..., T r ⊆ V ( G ) and c , c , ..., c r ∈ {− ǫ , ǫ } for some r = O ( ǫ − ) , such that d (cid:3) ( G, d ( G ) + c K S ,T + · · · + c r K S r ,T r ) ≤ ǫ. Remark.
Given a decomposition as above, we obtain the 2 ǫ -regular Frieze-Kannan partition thatgives the common refinement of all S i , T i in time O ( nr ), by going through the vertices of the graph,and checking, for each vertex, which parts it does and does not belong to. Remark.
As in the case of the usual regularity lemma, it is possible to obtain an equitable partitionin the Frieze–Kannan regularity lemma, increasing the number of parts and the cut distance bya negligible amount. This can be done by arbitrarily partitioning each part into essentially equalsize parts of the desired size and a remainder part, and then arbitrarily partitioning the union ofthe remainder vertices into parts of the desired size. We leave the details of this algorithm to thereader.In Section 3, using the above algorithmic weak regularity lemma, we obtain a deterministicalgorithm for approximating the number of copies of a fixed vertex graph H in a large vertex graph G . Note that there is an easy randomized algorithm for estimating the number of copies of H bysampling. However, it appears to be nontrivial to estimate this quantity deterministically. Duke,Lefmann and R¨odl [4] gave an approximation algorithm for the number of copies of a k -vertexgraph H in an n -vertex graph G up to an error of at most ǫn k in time O (2 ( k/ǫ ) O (1) n ω + o (1) ). Wegive a new algorithm which significantly improves the running time dependence on both n and ǫ . Theorem 1.4.
There is a deterministic algorithm that, given ǫ > , a graph H , and an n -vertexgraph G , outputs, in O ( ǫ − O H (1) n ) time, the number of copies of H in G up to an additive errorof at most ǫn v ( H ) .Remark. An examination of the proof shows that the exponent of ǫ − in the running time can be9 | H | (though not believed to be optimal). For example, we can count the number of cliques of order1000 in an n -vertex graph up to an additive error n − − in time O ( n . ). Remark.
All results here can be generalized easily to weighted graphs G with bounded edge-weights.2. Algorithmic weak regularity
Here we prove Theorem 1.3. We will prove the following, roughly equivalent form. In order tostate it, we first give some notation. Given a matrix A , we denote by k A k the spectral norm, i.e.the largest singular value. It is well known that this is equal to the operator norm of A when viewedas an operator between L -spaces. We also use the Frobenius norm k A k F = sX i,j a i,j . and the entry-wise maximum norm k A k max = sup i,j | a i,j | . Given a set S ⊆ [ n ], we will denote by S ∈ R n the characteristic vector of S . Theorem 1.4 replaces [6, Theorem 1.4], which we retracted [5].
JACOB FOX, L ´ASZL ´O MIKL ´OS LOV ´ASZ, AND YUFEI ZHAO
Theorem 2.1.
There is an algorithm that, given an ǫ > and a matrix A ∈ [ − , n × n , outputs,in ǫ − O (1) n time, subsets S , . . . , S r , T , . . . , T r ⊆ [ n ] and real numbers c , . . . , c r ∈ {− ǫ , ǫ } forsome r = O ( ǫ − ) , such that, setting A ′ = r X i =1 c i S i ⊤ T i , each row and column of A − A ′ has L -norm at most √ n (i.e. the sum of the squares of the entriesis at most n ), and k A − A ′ k ≤ ǫn. It is well-known that if G and H are weighted bipartite graphs between two sets X, Y of size n ,and A G , A H are the adjacency matrices, with rows corresponding to X and columns correspondingto Y , then d (cid:3) ( G, H ) ≤ k A G − A H k n . Indeed, for any
S, T ⊆ [ n ], taking the characteristic vectors S and T , we have | e G ( S, T ) − e H ( S, T ) | = (cid:12)(cid:12)(cid:12) ⊤ S ( A G − A H ) ⊤ T (cid:12)(cid:12)(cid:12) ≤ k A G − A H kkk S k k T k ≤ k A G − A H k n. Therefore, this theorem indeed implies Theorem 1.3 (taking A to be A G − d ( G ) ⊤ ).The proof of the Frieze–Kannan regularity lemma and its algorithmic versions, roughly speaking,run as follows: • Given a partition (starting with the trivial partition with one part), either it is ǫ -FK-regular(in which case we are done), or we can exhibit some pair of subsets S, T of vertices thatwitness the irregularity (in the algorithmic versions, one may only be guaranteed to find S and T that witness irregularity for some smaller value of ǫ ). • Refine the partition by using S and T to split each part into at most four parts, therebyincreasing the total number of parts by a factor of at most 4. • Repeat. Use a mean square density increment argument to upper bound the number ofpossible iterations.This can be modified to prove the approximation version. Roughly speaking, to find the appro-priate S i , T i , c i , in the second step of the above outline of the proof of the weak regularity lemma,instead of using S and T to refine the existing partition, we subtract c S ⊤ T from the remainingmatrix, for a carefully chosen c . We record the corresponding S i , T i , c i in step i of this iteration. Wecan bound the number of iterations by observing that the L norm of A − c S ⊤ T − · · · − c i S i ⊤ T i must decrease by a certain amount at each step.As for the algorithmic versions, the main challenge is checking whether a partition is regular, ora cut graph approximation is close in cut distance. Given a matrix A , up to a polynomial changein ǫ , having small singular values as a fraction of n is equivalent to tr AA ⊤ AA ⊤ being small as afraction of n , which roughly says that most scalar products of rows are small as a fraction of n .In [1], the authors use this fact to obtain an algorithm which runs in O ( n ω + o (1) ) time and eithercorrectly states that a pair of parts is ǫ -regular, or gives a pair of subsets which realizes it is not ǫ O (1) -regular. This was adapted in [2] to the weak regular setting. In [10], the authors noticedthat it suffices to check the scalar products along the edges of a well-chosen expander, which has alinear number of edges in terms of n , allowing them to obtain an O ǫ ( n )-time algorithm. This wasalso the main idea in [3], but their algorithm is double exponential in ǫ − . A further challenge inproving Theorem 2.1 with the cut matrix approximation is that the entries of the approximationmatrices may not stay bounded, which was used in the algorithms for checking regularity. This isproblematic, because for a general matrix A , the singular value (divided by n ) and the cut normmay be quite different. To counter this, we give an algorithm which checks regularity effectively FAST NEW ALGORITHM FOR WEAK GRAPH REGULARITY 5 under a weaker assumption that simply the L -norm of each row and each column stays bounded.Heuristically, the reason this property is useful is that it implies that if we have a singular vector(with norm 1) with a relatively large singular value, then no entry can be “too large”, it must be“spread out”, which can then be used to show that a large singular value implies a large cut norm.We then show that if we are careful, we can make sure that this property holds throughout theprocess.Let us state this more precisely. Given a matrix A , let a i be the i -th row of A and a j the j -thcolumn. Our main ingredient then is the following theorem. Note that in the algorithm below, theparameter C affects the running time but not the discrepancy of the output sets S, T . Theorem 2.2.
There exists a ( C/ǫ ) O (1) n algorithm which, given a matrix A ∈ R n × n such that k A k max ≤ C , and each k a i k ≤ n , k a j k ≤ n (or equivalently k A ⊤ A k max , k AA ⊤ k max ≤ n ), either • Correctly outputs that each singular value of A is at most ǫn , or • Outputs sets
S, T ⊆ [ n ] such that (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) X i ∈ S,k ∈ T a i,k (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≥ ǫ n . (This implies that A has a singular value that is at least ǫ n .) In the next lemma, we construct the expander along which we will check the scalar products.For an integer n , let J n denote the n × n matrix with each entry equal to 1. Lemma 2.3.
There exist fixed absolute constants l > and < c < such that there is analgorithm which given d and n , outputs a matrix M on R n × n with nonnegative integer entries,and an integer d with d ≤ d ≤ ld , such that k dn J n − M k ≤ d − c . In other words, for any vector v = ( v i ) ni =1 ∈ R n , we have (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) X i v i ! − nd v ⊤ M v (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≤ nd c k v k . (2) The running time of the algorithm is O ( dn (log n ) O (1) ) .Proof. Construct an l -regular two-sided expander G on [ e n ] for some n ≤ e n ≤ Kn with K fixed.This can be done in n (log n ) O (1) time. For example, Margulis [13] constructed an 8-regular expanderon Z m × Z m for every m , and Gabber and Galil [9] showed that all other eigenvalues (besides 8with multiplicity 1) are at most 5 √ <
8. For every vertex ( x, y ) ∈ Z m × Z m , its eight neighborsare ( x ± y, y ) , ( x ± (2 y + 1) , y ) , ( x, y ± x ) , ( x, y ± (2 x + 1)) . Therefore we can compute, for each vertex, a list of neighbors in time O (log m ) = O (log n ), whichthen takes O ( n log n ) time total. Alternatively, we can start with a Ramanujan graph for somefixed degree, constructed explicitly by Lubotzky, Phillips, and Sarnak [12]; Margulis [14]; andMorgenstern [15].The adjacency matrix A G has A G = l and all eigenvalues besides l have absolute value atmost some explicit a < l . Let k be the integer and f M = A kG be such that d n e n ≤ e d := l k < ld n e n .Note that f M is symmetric and has nonnegative integer entries, so it is the adjacency matrix ofsome graph G (possibly with multiple edges and loops). Clearly f M = e d , so e d is an eigenvalue JACOB FOX, L ´ASZL ´O MIKL ´OS LOV ´ASZ, AND YUFEI ZHAO of f M , and all other eigenvalues have absolute value at most a k = a log l ( e d ) = e d log l ( a ) . Since a < l , e c := 1 − log l ( a ) >
0. This implies that k e d e n J e n − f M k ≤ e d − e c . Take any set of n vertices, let M be the restricted submatrix of f M , and let d = n e n e d . As e nn ≤ K ,and the spectral norm of a matrix cannot increase when taking a submatrix, we have that k dn J n − M k ≤ k e d e n J e n − f M k ≤ e d − e c = (cid:18) e nn d (cid:19) − e c ≤ ( Kd ) − e c ≤ d − c for an explicit c > G in time (log n ) O (1) n . We make sure, for each vertex, to keep a list of itsneighbors. We then compute A iG for i = 1 , , ..., k . In each case, we make sure to keep a list ofthe l i neighbors of each vertex (with multiplicities). We can then compute A i +1 G in O ( l i n ) timeby computing the list of l i +1 neighbors for each vertex, by looking at its l neighbors in G andtaking the (multiset) union. The total running time is therefore O ((log n ) O (1) n + P ki =1 l i n ) = O (((log n ) O (1) + d ) n ). (cid:3) Alternatively, we could have used the zig-zag construction of expanders due to Reingold, Vadhan,and Wigderson [16].
Proof of Theorem 2.2.
Throughout this proof, we use the convention that i and j refer to rows, k and l refer to columns. The basic idea of the algorithm is the following. It is easy to see thattr( AA ⊤ AA ⊤ ) = X i,j,k,l a i,k a i,l a j,k a j,l . (3)In order to estimate this sum, we can use the expander to only compute the sum for pairs ( i, j )which form an edge of the expander (and then multiply by n/d ). In fact, this is true even for theterms in (3) corresponding to a fixed k, l . We can therefore use the expander to estimate the sumin (3), and if it is large, find a k for which the sum of the terms corresponding to k are large. Thiswill allow us to find sets S, T as required.Here is the algorithm.1. Construct the matrix M according to Lemma 2.3 that satisfies (2) (inputting d = (3 C ǫ − ) /c ).Let M = ( m i,j ) ni,j =1 .2. For each i, j with m i,j >
0, compute s i,j = h a i , a j i .3. For each k ∈ [ n ], compute b k = n X i,j =1 m i,j a i,k a j,k s i,j .
4. If each b k ≤ ǫ dn , return that k A k ≤ ǫn .5. If some b k ≥ ǫ dn , do the following:a. Compute for each l c l = X i a i,k a i,l . b. Let T be either the set of l such that c l >
0, or the set of l such that c l <
0, whichever has abigger sum in absolute value.c. Compute for each i ∈ [ n ] the values d T ( i ) = X k ∈ T a i,k . FAST NEW ALGORITHM FOR WEAK GRAPH REGULARITY 7 d. Let S be either the set of i ∈ [ n ] such that d T ( i ) > i ∈ [ n ] such that d T ( i ) < M in time (log n ) O (1) dn . We cancompute each s i,j in O ( n ) time, so computing all of them takes O ( dn ) time in total. Computingeach b k then similarly takes O ( dn ) time (since we only need to sum the terms where m i,j > O ( dn ) total time. If the algorithm says that k A k ≤ ǫn , then we are done. Otherwise, computing each c l can be done in time O ( n ), so that takes O ( n ) time in total. We then obtain T in O ( n ) time. Computing S then similarly takes O ( n )time. Since d = ( C/ǫ ) O (1) , this shows that the algorithm runs in time ( C/ǫ ) O (1) n .We now show that the algorithm is correct. First, we show the following lemma, which makesprecise that we can use the expander to estimate the sum (3). Lemma 2.4.
For any k, l ∈ [ n ] , we have (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)X i,j a i,k a i,l a j,k a j,l − nd X i,j m i,j a i,k a i,l a j,k a j,l (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≤ C n d c ≤ ǫ n . (4) Proof.
Let a k,l be the vector with entries ( a k,l ) i = a i,k a i,l . Since each | a i,j | ≤ C , we have that k a k,l k ≤ C n . Therefore, by (2), (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) X i a i,k a i,l ! − nd a ⊤ k,l M a k,l (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≤ C n d c . Clearly X i a i,k a i,l ! = X i,j a i,k a i,l a j,k a j,l , and by the definition of M and a k,l , we have a ⊤ k,l M a k,l = X i,j m i,j a i,k a i,l a j,k a j,l . (cid:3) Lemma 2.5.
If the algorithm returns that k A k ≤ ǫn then it is correct.Proof. We have X k,l X i,j m i,j a i,k a i,l a j,k a j,l = X i,j m i,j h a i , a j i = X k X i,j m i,j a i,k a j,k h a i , a j i = X k b k ≤ ǫ dn . Summing (4) over all pairs k, l ∈ [ n ], we have (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)X k,l X i,j a i,k a i,l a j,k a j,l − nd X k,l X i,j m i,j a i,k a i,l a j,k a j,l (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≤ ǫ n . Therefore, tr AA ⊤ AA ⊤ = X i,j,k,l a i,k a i,l a j,k a j,l ≤ nd X i,j m i,j h a i , a j i + ǫ n ≤ ǫ n . Since tr AA ⊤ AA ⊤ is the sum of the fourth powers of the singular values, this implies that eachsingular value is at most ǫn . (cid:3) JACOB FOX, L ´ASZL ´O MIKL ´OS LOV ´ASZ, AND YUFEI ZHAO
Lemma 2.6.
If the algorithm returns S and T , then (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) X ( i,l ) ∈ S × T a i,l (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≥ ǫ n . Proof.
First, note that for the particular k we obtain in the algorithm, we have23 ǫ dn ≤ b k = X i,j m i,j a i,k a j,k b i,j = X i,j,l m i,j a i,k a j,k a i,l a j,l . we claim that we have X l,i,j ∈ [ n ] a i,k a j,k a i,l a j,l ≥ nd X i,j,l m i,j a i,k a j,k a i,l a j,l − ǫ n ≥ ǫ n . Indeed, for any fixed l , by (4), we have (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) X i,j ∈ [ n ] a i,k a j,k a i,l a j,l − nd X i,j m i,j a i,k a j,k a i,l a j,l (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≤ ǫ n , and we can add this up over all l ∈ [ n ]. Let u = ( a i,k ) ni =1 , and v be the vector with coordinates v l = X i a i,k a i,l . Then k v k ∞ ≤ n , and k u k ≤ √ n and we have u ⊤ A v ≥ ǫ n . Note however, that | u ⊤ A v | ≤ k u ⊤ A k k v k ∞ . Therefore, we obtain that k u ⊤ A k ≥ ǫ n . Since T consists of either the positive or the negative coordinates of u ⊤ A , whichever one has largersum in absolute value, this implies that the T that we obtain in step 5b satisfies, with T thecharacteristic vector, (cid:12)(cid:12)(cid:12) u ⊤ A T (cid:12)(cid:12)(cid:12) ≥ ǫ n . Since k u k ≤ √ n , by the Cauchy-Schwarz inequality, this implies that k A T k ≥ ( u ⊤ A T ) k u k ≥ ǫ n . Since each row a i of A has k a i k ≤ √ n , we also have that k A T k ∞ ≤ √ n k T k ≤ n. Therefore, k A T k ≥ k A T k k A T k ∞ ≥ ǫ n . This means that for the S that we obtain in step 5d, we have, if S is the characteristic vector, (cid:12)(cid:12)(cid:12) ⊤ S A T (cid:12)(cid:12)(cid:12) ≥ ǫ n ≥ ǫ n , which is what we wanted to show. (cid:3) FAST NEW ALGORITHM FOR WEAK GRAPH REGULARITY 9
We have seen that either output of the algorithm must be correct, so this completes the proofof Theorem 2.2. (cid:3)
Before proving Theorem 2.1, we need one more technical lemma.
Lemma 2.7.
There exists an O ( n ) time algorithm which takes as input a matrix A ∈ R n × n andsubsets S, T ⊆ [ n ] such that X i ∈ Sk ∈ T a i,k ≥ ǫ ′ n , and outputs sets S ′ , T ′ ⊆ [ n ] such that X i ∈ S ′ ,k ∈ T ′ a i,k ≥ ǫ ′ n . Furthermore, for any i ∈ S ′ , X k ∈ T ′ a i,k ≥ ǫ ′ n, and for any k ∈ T ′ , X i ∈ S ′ a i,k ≥ ǫ ′ n. Proof.
Here is the algorithm.1. To start, set S ′ = S and T ′ = T .2. For each i ∈ S ′ and each k ∈ T ′ , store the sum of the corresponding row or column in thesubmatrix induced by S ′ × T ′ .3. Check whether there is a row or column with sum less than ǫ ′ n .4. If there is, delete it, and update the row or column sums by subtracting the correspondingelement from each sum.5. Go back to step 3 and repeat until no such row or column remains.We first show that the running time is O ( n ). We can compute each row and column sum in O ( n )time, therefore step 2 takes O ( n ) time total. Each time we delete an element from S ′ or T ′ , weperform O ( n ) subtractions. The loops runs for at most 2 n iterations since | S | + | T | ≤ n . Thusthe algorithm takes O ( n ) time.We next show that the algorithm is correct. In each step, the sum decreases by at most ǫ ′ n , andthere are at most 2 n steps total. Therefore, after this process, for the S ′ and T ′ that we kept, wemust still have X ( i,k ) ∈ S × T a i,k ≥ ǫ ′ n . In particular, this implies that when the algorithm terminates, S ′ and T ′ cannot be empty. By thedefinition of the algorithm, if it terminates, we must have the property that for any i ∈ S ′ , X k ∈ T ′ a i,k ≥ ǫ ′ n, and for any k ∈ T ′ , X i ∈ S ′ a i,k ≥ ǫ ′ n. This completes the proof of the lemma. (cid:3)
We are now ready to prove our main theorem.
Proof of Theorem 2.1.
Let ǫ ′ = ǫ / A = A .2. For each l starting at 0, do the following.a. Apply the algorithm from Theorem 2.2 to A l .b. If the algorithm returns that k A l k ≤ ǫn , then FINISH.c. Otherwise, the algorithm outputs sets S, T ⊆ [ n ] such that (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) X i ∈ S,k ∈ T a i,k (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≥ ǫ ′ n . Let σ ∈ {− , } be the sign of the above sum.d. Use Lemma 2.7, applied to σA l (and S , T from above), to find S ′ , T ′ ⊆ [ n ] such that σ X i ∈ S ′ ,k ∈ T ′ a i,k ≥ ǫ ′ n . Furthermore, for any i ∈ S ′ , σ X k ∈ T ′ a i,k ≥ ǫ ′ n, and for any k ∈ T ′ , σ X i ∈ S ′ a i,k ≥ ǫ ′ n. Replace S and T with S ′ and T ′ .e. Let S l = S , T l = T , t = σ ǫ ′ , and A l +1 = A l − tK S l ,T l .Let us first show that we can indeed apply Theorem 2.2 to each A l . We first show that if v is arow or column of A l , then k v k ≤ n. By the assumptions of the theorem, this is true for l = 0. Fix l so that it is true for A l , let a i,k bethe entries of A l , and let i be any row. If i / ∈ S , then the row does not change, so the L norm ofthe row does not change in A l +1 . If i ∈ S , then we have X k ∈ T a i,k − ( a i,k − t ) = 2 t X k ∈ T a i,k − | T | t ≥ tσ ǫ ′ n − t n = t (cid:18) σ ǫ ′ − t (cid:19) n = 0 . Since the entries in A l were a i,k , and the entries in A l +1 are a i,k − t , this implies that the L -normof the corresponding row in A l +1 cannot increase, and so for each row it is still at most √ n . Theanalogous argument for columns shows that the same holds for each column.Next, note that each entry of A has absolute value at most 1, and each entry changes by atmost ǫ ′ when going from A l to A l +1 . Therefore, each entry of A l is at most 1 + lǫ ′ / C = 1 + lǫ ′ / k A l +1 k F ≤ k A l k F − ǫ ′ n . FAST NEW ALGORITHM FOR WEAK GRAPH REGULARITY 11
Let a i,k be the entries of A l again. We have k A l k F − k A l +1 k F = X i ∈ Sk ∈ T a i,k − ( a i,k − t ) = 2 t X i ∈ Sk ∈ T a i,k − | S || T | t ≥ σ tǫ ′ n − | S || T | t ≥ (cid:18) σ tǫ ′ − t (cid:19) n . With our choice of t = σ ǫ ′ , this is implies that k A l +1 k F ≤ k A l k F − ǫ ′ n . Now, we must have k A || F ≤ n . Since the square of the Frobenius norm decreases by at least ǫ ′ n = ǫ n in each step, the number of steps is at most O (1 /ǫ ). Therefore, after at most O (1 /ǫ ), the algorithm must terminate.As for the running time, the algorithm from Theorem 2.2 (with C = 1 + lǫ ′ /
3) takes at most O (( l/ǫ ) O (1) n ) = ǫ − O (1) n time as l = O ( ǫ − ). The algorithm from Lemma 2.7 takes O ( n ) time.Finally, as the number of steps is O ( ǫ − ), the whole process takes ǫ − O (1) n time. (cid:3) Approximation algorithm for subgraph counts
We would like to approximate the number of copies of a fixed k -vertex graph H in an n -vertexgraph G , up to an additive error of at most ǫn k . In this section, we prove Theorem 1.4, whichclaims an algorithm to perform the task in O ( ǫ − O H (1) n ) time.It will be cleaner to work instead with hom( H, G ), the number of graph homomorphisms from H to G . This quantity differs from the number of (labeled) copies of H in G by a negligible O H ( n v ( H ) − ) additive error. We use the following multipartite version. Definition 3.1.
Let H be a graph on [ k ], and let G be a k -partite weighted graph with vertex sets V , . . . , V k . We write hom ∗ ( H, G ) = X ( v ,...,v k ) ∈ V ×···× V k Y { i,j }∈ E ( H ) G ( v i , v j ) , (5)where G ( x, y ) denotes the edge-weight of { x, y } in G , as usual.Note that for graphs H and G , hom ∗ ( H, G ) counts the number graph homomorphisms from H to G where every vertex v i ∈ V ( H ) is mapped to the associated vertex part V i in G .For every graph G , there is a k -partite G ∗ , obtained by replicating each vertex of G into k identical copies and two vertices of G ∗ are adjcent if the original vertices in G they came from areadjacent, such that hom( H, G ) = hom ∗ ( H, G ∗ ). Thus Theorem 1.4 follows from its multipartitegeneralization below. Theorem 3.2.
There exists a deterministic algorithm that takes as input a graph H on [ k ] , a k -partite graph G with each vertex part having at most n vertices, and ǫ > , and outputs, in time ǫ − O H (1) n , a quantity that approximates hom ∗ ( H, G ) up to an additive error of at most ǫn k .Proof. We begin with a description of the algorithm. If H has no edges, then hom ∗ ( H, G ) = | V | · · · | V k | . Assume now that H has at least one edge, say { , } (relabeling if necessary). Denotethe vertex parts of G by V , . . . , V k . Let G denote the bipartite graph induced by V and V in G ,and d ( G ) = d ( V , V ) = e ( V , V ) / ( | V || V | ) to denote the edge density between V and V in G . ByTheorem 1.3, we can algorithmically find S , . . . , S r ⊆ V , T , . . . , T r ⊆ V , and c , . . . , c r = O ( ǫ ), with r = O ( ǫ − ), such that the weighted bipartite graph G ′ on vertex sets V and V defined by G ′ = d ( G ) + r X i =1 c i K S i ,T i (6)satisfies d (cid:3) ( G , G ′ ) ≤ ǫ/ . Let G ( i ) be G obtained by deleting the vertices ( V \ S i ) ∪ ( V \ T i ). Let H ′ be H with edge { , } removed. Since H ′ has one fewer edge than H , we can recursively apply the algorithm to estimateeach of hom ∗ ( H ′ , G ), hom ∗ ( H ′ , G (1) ) , . . . , hom ∗ ( H ′ , G ( r ) ) up to an additive error of at most cǫ ,where c is some absolute constant. Summing up a linear combination of these estimates, we obtainan estimate for d ( G , G ) hom ∗ ( H ′ , G ) + r X i =1 c i hom ∗ ( H ′ , G ( i ) ) , which we use as our estimate for hom ∗ ( H, G ).Now we prove the correctness of the algorithm. Let G ′ be obtained from G by replacing thebipartite graph between V and V by G ′ . We claim that (cid:12)(cid:12) hom ∗ ( H, G ) − hom ∗ ( H, G ′ ) (cid:12)(cid:12) ≤ ǫn k . (7)Indeed,hom ∗ ( H, G ) − hom ∗ ( H, G ′ ) = X ( v ,...,v k ) ∈ V ×···× V k f v ,...,v k ( v ) g v ,...,v k ( v )( G ( v , v ) − G ′ ( v , v ))for some f v ,...,v k ( v ) , g v ,...,v k ( v ) ∈ { , } obtained by appropriately grouping the G ( v i , v j ) factorsin (5). For fixed ( v , . . . , v k ) ∈ V × · · · × V k , we have (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) X ( v ,v ) ∈ V × V f v ,...,v k ( v ) g v ,...,v k ( v )( G ( v , v ) − G ′ ( v , v )) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≤ max U ⊂ V ,W ⊂ V | e G ( U, W ) − e G ′ ( U, W ) | ≤ n d (cid:3) ( G , G ′ ) ≤ ǫn / . Then, summing over all ( v , . . . , v k ) ∈ V × · · · × V k and applying the triangle inequality, we obtain(7).From (6), we havehom ∗ ( H, G ′ ) = d ( G ) hom ∗ ( H ′ , G ) + r X i =1 c i hom ∗ ( H ′ , G ( i ) ) . Since c i = O ( ǫ ) and r = O ( ǫ − ), we obtain an estimate of hom ∗ ( H, G ′ ) up to an additive errorof at most ǫn k / ∗ ( H ′ , − ) in the above sum is estimated up to an additiveerror cǫ for an appropriate positive constant c . Together with (7), the estimate is within ǫn k ofhom ∗ ( H, G ), as claimed.Now we analyze the running time. It takes ǫ − O (1) n time (independent of H ) to find S , . . . , S r , T , . . . , T r , and c , . . . , c r . Estimating each hom ∗ ( H ′ , G ), hom ∗ ( H ′ , G (1) ) , . . . , hom ∗ ( H ′ , G ( r ) ) up toan additive error of at most cǫ takes ǫ − O H ′ (1) n time (by induction), and we need to perform r + 1 = O ( ǫ − ) such estimates. Thus the total running time is ǫ − O H (1) n . (cid:3) We use the assumption that 0 ≤ G ≤ ≤ G ′ ≤
1, which is not necessarily the case.
FAST NEW ALGORITHM FOR WEAK GRAPH REGULARITY 13
References [1] N. Alon, R. A. Duke, H. Lefmann, V. R¨odl, and R. Yuster,
The algorithmic aspects of the regularity lemma , J.Algorithms (1994), 80–109.[2] D. Dellamonica, S. Kalyanasundaram, D. Martin, V. R¨odl, and A. Shapira, A deterministic algorithm for theFrieze-Kannan regularity lemma , SIAM J. Discrete Math. (2012), 15–29.[3] D. Dellamonica, Jr., S. Kalyanasundaram, D. M. Martin, V. R¨odl, and A. Shapira, An optimal algorithm forfinding Frieze-Kannan regular partitions , Combin. Probab. Comput. (2015), 407–437.[4] R. A. Duke, H. Lefmann, and V. R¨odl, A fast approximation algorithm for computing the frequencies of subgraphsin a given graph , SIAM Journal on Computing (1995), 598–620.[5] J. Fox, L. M. Lov´asz, and Y. Zhao, Erratum for: On regularity lemmas and their algorithmic applications .[6] J. Fox, L. M. Lov´asz, and Y. Zhao,
On regularity lemmas and their algorithmic applications , Combin. Probab.Comput. (2017), 481–505.[7] A. Frieze and R. Kannan, The regularity lemma and approximation schemes for dense problems , 37th AnnualSymposium on Foundations of Computer Science (Burlington, VT, 1996), IEEE Comput. Soc. Press, Los Alami-tos, CA, 1996, pp. 12–20.[8] A. Frieze and R. Kannan,
Quick approximation to matrices and applications , Combinatorica (1999), 175–220.[9] O. Gabber and Z. Galil, Explicit constructions of linear-sized superconcentrators , J. Comput. System Sci. (1981), 407–420, Special issued dedicated to Michael Machtey.[10] Y. Kohayakawa, V. R¨odl, and L. Thoma, An optimal algorithm for checking regularity , SIAM J. Comput. (2003), 1210–1235.[11] L. Lov´asz and B. Szegedy, Szemer´edi’s lemma for the analyst , Geom. Funct. Anal. (2007), 252–270.[12] A. Lubotzky, R. Phillips, and P. Sarnak, Ramanujan graphs , Combinatorica (1988), 261–277.[13] G. A. Margulis, Explicit constructions of expanders , Problemy Peredaˇci Informacii (1973), 71–80.[14] G. A. Margulis, Explicit group-theoretic constructions of combinatorial schemes and their applications in theconstruction of expanders and concentrators , Problemy Peredachi Informatsii (1988), 51–60.[15] M. Morgenstern, Existence and explicit constructions of q + 1 regular Ramanujan graphs for every prime power q , J. Combin. Theory Ser. B (1994), 44–62.[16] O. Reingold, S. Vadhan, and A. Wigderson, Entropy waves, the zig-zag graph product, and new constant-degreeexpanders , Ann. of Math. (2) (2002), 157–187.[17] E. Szemer´edi,
On sets of integers containing no k elements in arithmetic progression , Acta Arith. (1975),199–245.[18] E. Szemer´edi, Regular partitions of graphs , Probl`emes combinatoires et th´eorie des graphes (Colloq. Internat.CNRS, Univ. Orsay, Orsay, 1976), Colloq. Internat. CNRS, vol. 260, CNRS, Paris, 1978, pp. 399–401.
Department of Mathematics, Stanford University, Stanford, CA 94305.
E-mail address : [email protected] Department of Mathematics, UCLA, Los Angeles, CA 90095.
E-mail address : [email protected] Department of Mathematics, MIT, Cambridge, MA 02139.
E-mail address ::